# Average value change when filtering or changing size

**URL:** <https://discuss.elastic.co/t/average-value-change-when-filtering-or-changing-size/107587>\
**Category:** Kibana\
**Created:** [November 14, 2017, 4:34pm UTC](https://discuss.elastic.co/t/average-value-change-when-filtering-or-changing-size/107587 "2017-11-14T16:34:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [November 14, 2017, 8:42pm UTC](https://discuss.elastic.co/t/average-value-change-when-filtering-or-changing-size/107587/2 "2017-11-14T20:42:01Z")

</div>

This sounds like the effect of merging the results from independent shards into a single response, which is generally considered an approximation and with smaller result sizes (when compared to the cardinality) can sometimes result in inaccurate results. Check out [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#\_shard\_size\_3](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_shard_size_3)

I suggest using the `shard_size` parameter in your terms aggregation to ensure that it pulls back enough terms to get an accurate enough result for your use case. The correct number is really based on the cardinality of your field, and the way it is sharded, but it seems you have found a good number to start with.

---

_[View the full topic](https://discuss.elastic.co/t/average-value-change-when-filtering-or-changing-size/107587)._
