Query multiple indices with different fields to sort

Hello I am using Elasticsearch 7.10.0 and trying to solve following problem:
I have several indices and need to get documents from all of them matching different queries (5-15 queries against each index). However, depending on a query, it can be different field to sort on.

I also need to apply paging and have duplicates when a document matches more than one query. I need to know which query have been matched.

My first idea is to use multi query and have separate queries but I need paging of complete results and not each individual query result.

My second idea is to have one big query, join with 'should' but I am not sure if this is possible to define order on each should clause. Additionaly I need duplicates but 'should' clause will return a document first time it is matched.

Any other ideas?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.