Algolia has one ranking formula per index. Every index has a unique sorting strategy but you can’t change it at query time. This is because pre-sorting during indexing instead of at query time leads to a considerable performance boost.

The key use of replica indices is they let you provide different rankings for the same data.

Algolia lets you automatically replicate the content of one index (the primary) onto other indices (standard and virtual replicas) and synchronize content changes.

Standard and virtual replicas

Standard and virtual have similarities and differences that affect which one you should use but, in short, if you need:

  • Exhaustive sorting, pick standard replicas. Shows everything that matches, strictly sorted by a chosen attribute. For example, on a news site sort articles by publication date.
  • Relevant sorting, pick virtual replicas. It prioritizes relevant results while still incorporating the sorting preference for the chosen attribute. For example, searching for “chromebook” on an electronics site should show laptops first, not Chromebook accessories.

Similarities

  • You can search a replica index as you would any primary index.
  • You can’t add, update, or delete records in replica indices.
  • Both replica types synchronize with any updates made to records in the primary index. Every time you add, update, or delete records in your primary index, your replica is automatically modified. You can’t alter this automatic data synchronization.

Index settings

Replicas start with the same settings as their primary index, but you can change them. For example, to sort:

  • By price
  • In ascending order
  • In descending order
  • By most viewed.

Algolia applies one sorting strategy to each index.

You can only sort by attributes with boolean or numerical values. If you want to sort by dates, convert the dates to Unix timestamps.

To keep replica settings in sync with your primary index, set the primary index’s forwardToReplicas to true.

Differences

Standard replicasVirtual replicas
AvailabilityAvailable on all pricing plansOnly available on the Build and Premium pricing plans
RecordsIncreases the number of records since it’s a copy of its primary indexDoesn’t increase the number of records since it’s just a view of its primary index. It does slightly increase the primary index’s size (but by less than 10 MB per million records)
UsageOptimized for exhaustive sortingOptimized for relevant sorting
Number of replicas per indexUnlimited20
Supported index settingsAllA subset
SynonymsSupports all synonym typesSupports most synonym types, except placeholders

Manage replicas

Create replicas

Create replicas with the dashboard or the API and then change the replica’s sorting.

You can’t edit the contents of a replica index. If you want to edit or delete the replica, you first have to unlink it from its primary index, which turns it into a regular index. Once unlinked, changes to the primary index no longer propagate to the replica index.

Detaching a virtual replica creates an empty index.

Virtual replica parameters

Virtual replicas support a subset of the index settings. You can find the supported and unsupported parameters in the following lists.

Supported parameters

Unsupported parameters

You can’t change the following parameters for virtual indices. Instead, change them on the corresponding primary index or create a standard replica.