Pagination with aggregation without sequential access

Hi,

We have a problem regarding pagination with aggregation. We are using terms aggregation with top hits to show the results grouped by certain property and show certain number of results under each group.

We want to paginate over the buckets. Suppose we want to show x results per page. What we are doing is getting x buckets for the first page, getting 2x results for second page and skipping the first x and so on. But that's where the real problem starts.

What's happening is that the order of first x buckets when we request x buckets is different than when we request 2x buckets. So when we show results of second page, some results from first page are also shown there because of different order. Ideally this should not happen as the relevancy of results should not depend on the number of results we request.

Can someone look into this and tell us what is happening here. Is there is something that we are doing wrong or is there any better way to paginate aggregation buckets (we don't want to use composite aggregation as we don't want sequential access to buckets).

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