Using Replica Indices
On this page
A replica index is a copy of your index, that allows you to use different ranking strategies, for example, a different custom ranking, or sorting.
Copying settings between applications and indices
The data from your indices and their analytics are two different data sets on two different services. The analytics data references its corresponding index by name. This reference never changes. This has the following consequences:
- When copying an index, the associated analytics data isn’t copied.
-
When deleting an index, the associated analytics data isn’t deleted, allowing you to export and back up the analytics data.
Your engineering team can export the analytics data using an API client. You can’t export analytics data from the dashboard.
- When renaming an index, Algolia collects new analytics data. The old and new analytics data won’t be merged.
Creating new replica indices
Each index has one ranking strategy. If you want to allow sorting the search results by different attributes, you can use replicas. For each different sorting strategy, you need one replica index. For example, if you want to allow sorting the search results alphabetically in ascending and descending order, you need to create two replica indices.
- Go to the Index section in the Algolia dashboard.
- Select the index for which you want to create replica indices.
- Select the Replicas tab.
-
Click Create Replica Index.
- In the Create a new replica dialog, enter a name for the new replica index.
-
Choose between standard replica or virtual replica.
Standard replicas duplicate the primary index’s records. Virtual replicas don’t duplicate the data set, but you can adjust only a subset of the primary index’s settings.
-
Click Create replica.
- Optional: you can create more than one replica.
- Save your changes.
Switching replica indices for different sorting strategies
If you want to allow users to sort the search results in different ways, you need to:
- Have one replica index per sorting strategy
- Switch the Algolia index or replica when the user changes the sorting strategy in your front end
For example, to allow sorting by price, you need three indices. One primary index with the default ranking of the search results, and two replica indices where the results are sorted by price, one for ascending, another for descending sort order.
You might need your engineering team’s help to replica the index for each searching strategy.
Forwarding settings to replica indices
With replica indices, you can apply different ranking strategies to your data, for example, custom ranking, or sorting. Settings and attributes that are the same between the replica indices are synced with the primary index. If you change a setting in your primary index, you must forward the changes to your replica indices.
Forwarding index settings
To forward a change of an index setting to the replica indices:
- Change an index setting in the Index section of the dashboard and review the change.
-
In the Review and save settings dialog, select Copy these settings to other indices and/or replicas to forward the changes to a subset or all replicas.
Forwarding synonyms and rules
When adding, editing, or deleting synonyms or rules, select the Forward to replicas option to copy these changes to the replica indices.
- Go to the AI Synonyms page in the dashboard.
-
Select Forward to replicas
-
Review and publish the changes.