🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
Guides / Managing results / Refine results / Sorting results

Algolia uses one ranking strategy per index. If you want to use different rankings for the same data, you can use replica indices.

Standard and virtual replicas

Standard replicas are exact copies of your index. They let you to have a completely different configuration of your index, while keeping the data in sync with your primary index.

Virtual replicas don’t copy the data from their primary index. They’re more efficient than standard replica, but you can only change a subset of the index settings. Virtual replicas are optimized for relevant sorting.

Virtual replicas aren’t available on the Grow plan.

Naming replica indices

To help you identify your replica indices, you should adopt a naming pattern, such as {primaryIndex}_{sortingAttribute}_{asc_or_desc}. For example, products_price_desc is a replica index of your products index, where the results are sorted by the price attribute in descending order.

Create replica indices in the dashboard

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Algolia Search Search.
  3. Select your Algolia index:

    Select your Algolia application and index

  4. On the Replicas tab, click Create Replica Index.
  5. In the Create a new replica dialog, select Standard Replica (default) or Virtual Replica for Relevant Sort, enter a name for your replica, and click Create replica.
  6. You can add multiple replicas at once.
  7. Click Review and Save Settings.

Create replica indices with the API

To create replica indices, use the replicas setting in your primary index.

1
2
3
4
5
$index->setSettings([
  'replicas' => [
    'products_price_desc'
  ]
]);

To create virtual indices, use the virtual modifier for the replica index name:

1
2
3
4
5
$index->setSettings([
  'replicas' => [
    'virtual(products_price_desc)'
  ]
]);

Next steps

After creating your replica indices, you can change their settings—for example, by adding a attribute for sorting.

Did you find this page helpful?