If I am running an aggregation against a query - will the results be accurate? Is the doc_count inaccurate only when there is no query? aggregation accuracy
1 Answer
To get accurate aggregation document count, you can explicitly set the size parameter to 0. See this for more information. But mind you, this is more expensive.
5 Comments
Roxana
so, by default, if I have an aggregation ran against a query and specify the size, then I can get results that are not accurate?
bittusarkar
Yes. This is very nicely explained at elasticsearch.org/guide/en/elasticsearch/reference/current/….
Roxana
that is the same link I gave in my question - but there is the plain aggregation. would it be the same behavior if the aggregation is 'activated' in the context of a query?
bittusarkar
What do you mean by "aggregation activated in the context of a query"? Can you explain with a simple example please?
Roxana
{query: {some query}, aggs{}}