stpk
stpk

Reputation: 2125

ElasticSearch aggregations for all pages

I use size and from keywords for pagination across ElasticSearch results and each page change requires another search query to be executed.

I would like to compute facets with the aggregations feature, however aggregations are computed only based on the results constrained by size and from keywords e.g. when I ask for records 20-30 from the list, the aggregations are computed only on these 10 records that are returned. And I would like of course to have global facets computed on all the matching records that do not change while I switch the pages.

Any ideas how to do it apart from performing an additional global (uncostrained by size and from) search?

Upvotes: 0

Views: 162

Answers (1)

bittusarkar
bittusarkar

Reputation: 6357

Aggregations are computed on all documents that match "query". The scope of aggregations has nothing to do with "size" and "from" values.

Upvotes: 1

Related Questions