# Option for exact aggregation instead of approximation?

**URL:** <https://discuss.elastic.co/t/option-for-exact-aggregation-instead-of-approximation/44996>\
**Category:** Kibana\
**Created:** [March 21, 2016, 1:53pm UTC](https://discuss.elastic.co/t/option-for-exact-aggregation-instead-of-approximation/44996 "2016-03-21T13:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisR](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@ChrisR](https://discuss.elastic.co/u/ChrisR)\
**Post date:** [March 21, 2016, 1:53pm UTC](https://discuss.elastic.co/t/option-for-exact-aggregation-instead-of-approximation/44996/1 "2016-03-21T13:53:51Z")

</div>

Kibana ought to have an option to display exact aggregations instead of approximations when returning a subset. In other words, when charting the top 50 results, kibana should be able to request aggregations with a size of 0 and then use only the first 50 buckets returned.

I'm seeing a case where there are three records with the same "key" id, one with a "total\_quantity" field value of 5000, another with 1000 and the third with 0. Each record is on a different shard. When I chart in ascending order on the key term and a size of 50, the key shows up with a total\_quantity sum of 0 instead of 6000. This is due to each shard only processing the bottom 50 and than reducing the results.

If I use a size of zero, I get accurate results, but the chart is too crowded with data to be useful.

Kibana should have a visualization option (maybe an "exact" checkbox) to query elasticsearch with a size of 0, but then chart only a subset (such as the top or bottom 50). Is this something Kibana will provide, or should I modify the code myself?

---

<div class="post-metadata">

**Author:** ![Joe\_Fleming](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_fleming/32/3561_2.png) [@Joe\_Fleming](https://discuss.elastic.co/u/Joe_Fleming)\
**Post date:** [March 22, 2016, 1:10am UTC](https://discuss.elastic.co/t/option-for-exact-aggregation-instead-of-approximation/44996/2 "2016-03-22T01:10:43Z")

</div>

Perhaps you already know this, but doing a query with `size: 0` is the same as not giving it a size at all, which is why you get so many records back. The results you are getting back when using `size: 50` is just what comes back from Elasticsearch, and the fact that it isn't what you expected it to be is a limitation of the way it queries your distributed data, but it sounds like you already knew that.

Anyway, I don't believe we have plans to modify the results that come back from Elasticsearch, as in general we try to never do that. But, as this would be an end-user setting, and part of the aggregation, it may be handy to expose, perhaps as an advanced setting.

I'd recommend [opening an issue](https://github.com/elastic/kibana/issues) about it and getting some more feedback on the topic, as well as potentially getting some additional support from other users.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:58pm UTC](https://discuss.elastic.co/t/option-for-exact-aggregation-instead-of-approximation/44996/3 "2017-07-06T13:58:21Z")

</div>


