# Term aggregation size 0

**URL:** <https://discuss.elastic.co/t/term-aggregation-size-0/64278>\
**Category:** Elasticsearch\
**Created:** [October 28, 2016, 12:36pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278 "2016-10-28T12:36:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 28, 2016, 12:36pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/1 "2016-10-28T12:36:21Z")

</div>

Hi, from ES5 now terms aggregation with size 0 are not supported anymore, see [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_aggregations_changes.html#_literal_size_0_literal_on_terms_significant_terms_and_geohash_grid_aggregations)

Sadly I was using it A LOT in kibana dashboard  
what's a good practice now?

[here](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html#_size) it says that a small size may get wrong result

thus I was thinking of setting a large size (i.e. 99999, things that I actually did and worked quite fine)

but i'm currently questioning whether it is a good practice or not, does it have bad performances? what's the trade off?

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [October 28, 2016, 2:09pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/2 "2016-10-28T14:09:01Z")

</div>

Setting size to 0 was dangerous as it could lead to the [bucket explosion problem](https://www.elastic.co/guide/en/elasticsearch/guide/current/_preventing_combinatorial_explosions.html). A good practice should be for users to have a rough idea how many buckets to expect and to specify a reasonable bound for it.

If you worry about imprecisions, have a look at this section:

[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)

---

<div class="post-metadata">

**Author:** ![il.bert](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@il.bert](https://discuss.elastic.co/u/il.bert)\
**Post date:** [October 28, 2016, 2:26pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/3 "2016-10-28T14:26:02Z")

</div>

ok, got it, what if I want them all? the solution is to set it large?

---

<div class="post-metadata">

**Author:** ![ywelsch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ywelsch/32/7751_2.png) [@ywelsch](https://discuss.elastic.co/u/ywelsch)\
**Post date:** [October 28, 2016, 2:27pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/4 "2016-10-28T14:27:19Z")

</div>

yes, to set it to a number that's large enough 😉

---

<div class="post-metadata">

**Author:** ![shanec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shanec/32/4004_2.png) [@shanec](https://discuss.elastic.co/u/shanec)\
**Post date:** [October 28, 2016, 2:32pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/5 "2016-10-28T14:32:03Z")

</div>

Most of the time, end users won't look at the 99,999th term in an aggregation. They probably won't look at the 10,000th. Or even the 1,000th. You should consider what people are actually going to look at and use that as a bounds.

---

<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 5, 2017, 10:08pm UTC](https://discuss.elastic.co/t/term-aggregation-size-0/64278/6 "2017-07-05T22:08:43Z")

</div>


