Merging mulitple Indices into one Replica

Is it possible to merge two or more indices into one Replica Index?
Or to merge multiple searches into one search result but with all results being sort by relevancy?
Search results by relevancy:

  1. result from first index
  2. result from second index
  3. result from first index
  4. result from first index
  5. result from second index

Hi @t.rzewuski

Ranking is pre-calculated within each individual index – that’s how we maintain speed. To combine the results of the two indices sorted by relevancy, you’d need to either combine the data into a single index, or perform two searches using multi-index search and combine the result sets programmatically as you render them.

Hi @chuck.meyer
Thank you for your response.
When performing two searches how can I combine the outputs to sort them by relevance? I can’t see any value in the responses that could be responsible for it. The only thing that could be somewhat relevant is results[0].hits[0].weight but in every hit I get a value of 0 Even those that have exact search results.

Each result set in the array should be pre-sorted by the ranking criteria defined by that index. You should just be able to interweave results from the arrays. If you prefer to stitch them together by a different attribute (weight in this case), you’ll need to make sure you expose that as an attribute returned by your index.

If you’re talking about the Algolia ranking score, remember you need to set getRankingInfo to true to pass this information to the client (Algolia view match score / confidence level as part of the returned object)

Regarding sorting search results by relevancy across multiple indices, most search engine provide mechanisms to sort results based on relevance source. When merging search results from different indices, you can sort the combined results based on their relevance scores to achieve a unified result set sorted by relevancy. This allows you to present the most relevant results from all the merged indices in a single search result.