I am doing a sorted query and so switched the main index to the relevant replica. I can see the replica has records and the searchable attributes are set along with the ranking and facets I need. These settings are already in the dashboard. But I am getting the error shown.
I have a screenshot of the index settings and you’ll notice that the ranking has some custom fields that were auto inserted (I only added the view field).
I also tried removing the replicas in the setSettings. The error goes away but it returns no results.
// this is how I init the index
constructor(appId: string, apiKey: string, indexName: string, env: string, sortingReplica?: SortingReplicas) {
this.requestOptions = { headers: { "x-algolia-application-id": appId } };
this.client = algoliasearch(appId, apiKey);
if (sortingReplica) {
this.mainIndexName = sortingReplica === SortingReplicas.DocsByModified
? env.toLocaleLowerCase() + "_" + SortingReplicas.DocsByModified
: env.toLocaleLowerCase() + "_" + SortingReplicas.DocsByViewed
} else {
this.mainIndexName = indexName;
}
this.index = this.client.initIndex(this.mainIndexName);
this.sortingReplica = sortingReplica;
this.index.setSettings({
attributesForFaceting: [
'searchable(parentSection)',
'filterOnly(group)'
],
replicas: [
sortingReplica === SortingReplicas.DocsByModified
? env.toLocaleLowerCase() + "_" + SortingReplicas.DocsByModified
: env.toLocaleLowerCase() + "_" + SortingReplicas.DocsByViewed
]
});
}
// this is my index settings