DBAtlas · Database operations atlas

too_many_buckets_exception: Trying to create too many buckets

Elasticsearch

What does it mean?

An aggregation query tried to produce more buckets than the allowed upper limit (search.max_buckets, default 65,536). The query was rejected to protect memory.

Why does it happen?

Aggregations such as terms/date_histogram run on high-cardinality fields with a very large size or a very fine interval; nested aggregations multiplying the bucket count. The limit is enforced because excessive bucket creation can exhaust node memory.

How to fix it

Reduce the number of buckets produced: lower the size of terms aggregations, widen the date_histogram interval, remove unnecessary nested aggregations. If many results are needed, page through them with a composite aggregation. Raising the limit should be a last resort and carries memory risk: search.max_buckets can be changed with PUT _cluster/settings, but do so carefully.

Open in DBAtlas →

More from this engine