too_many_buckets_exception: Trying to create too many buckets
ElasticsearchWhat 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.
More from this engine
- node_not_connected_exceptionNode is not connected
- receive_timeout_transport_exceptionRequest timed out waiting for a response from another node
- routing_missing_exceptionRouting value is required for this document
- shard_lock_obtain_failed_exceptionObtaining shard lock timed out
- parsing_exceptionFailed to parse the search request / query DSL
- max_bytes_length_exceeded_exceptionDocument contains at least one immense term that is too long
- illegal_argument_exception_total_fieldsLimit of total fields has been exceeded