Term aggregation size 0

Hi, from ES5 now terms aggregation with size 0 are not supported anymore, see here

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

here 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?

1 Like

Setting size to 0 was dangerous as it could lead to the bucket explosion problem. 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

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

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

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.