Standard and virtual replicas
Standard or virtual replicas are optimized for different use cases:- Exhaustive sorting. Use standard replicas if you want to show everything that matches, strictly sorted by a chosen attribute. For example, on a news site sort articles by publication date.
- Relevant sorting. Use virtual replicas to prioritize relevant results while still incorporating the sorting preference for the selected attribute. For example, searching for “notebook” should show laptops first, not notebook accessories.
This feature isn’t available on every plan.
Refer to your pricing plan to see if it’s included.
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
forwardToReplicas parameter to true with the setSettings method.
Differences
| Standard replicas | Virtual replicas | |
|---|---|---|
| Records | Increases the number of records since it’s a copy of its primary index | Doesn’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) |
| Usage | Optimized for exhaustive sorting | Optimized for relevant sorting |
| Number of replicas per index | Unlimited | 20 |
| Supported index settings | All | A subset |
| Synonyms | Supports all synonym types | Supports most synonym types, except placeholders |
| API response that returns the number of hits | nbHits | nbSortedHits |
| Optional filters | Applied after a sort-by attribute. Can’t be used to boost or bury records. | Incompatible with virtual replicas |
Manage replicas
For more information about managing replica indices, see:Supported index settings for virtual replicas
Virtual replicas support a subset of the index settings.Supported settings
advancedSyntaxadvancedSyntaxFeaturesallowTyposOnNumericTokensalternativesAsExactaroundPrecisionattributeCriteriaComputedByMinProximityattributesToHighlightattributesToRetrieveattributesToSnippetdistinctenablePersonalizationenableRulesexactOnSingleWordQueryhighlightPostTaghighlightPreTaghitsPerPageignorePluralsmaxFacetHitsmaxValuesPerFacetminProximityminWordSizefor1TypominWordSizefor2TypospaginationLimitedToqueryLanguagesqueryTyperemoveStopWordsreplaceSynonymsInHighlightresponseFieldsrestrictHighlightAndSnippetArrayssnippetEllipsisTextsortFacetValuesBytypoToleranceunretrievableAttributes
Unsupported settings
You can’t change the following parameters for virtual indices. Instead, change them on the corresponding primary index or create a standard replica.attributeForDistinctattributesForFacetingcamelCaseAttributescustomNormalizationdecompoundedAttributesdisableExactOnAttributesdisablePrefixOnAttributesdisableTypoToleranceOnAttributesdisableTypoToleranceOnWordsindexLanguageskeepDiacriticsOnCharactersnumericAttributesForFilteringoptionalWordsrankingsearchableAttributesseparatorsToIndexuserData