too_many_buckets_exception: Trying to create too many buckets(试图创建过多的桶)
Elasticsearch含义
聚合查询试图生成的桶数超过了允许的上限(search.max_buckets,默认 65,536)。为保护内存,查询被拒绝。
原因
在高基数字段上以非常大的 size 或非常细的间隔运行 terms/date_histogram 等聚合;嵌套聚合使桶数成倍增加。由于创建过多的桶可能耗尽节点内存,因此强制执行该限制。
解决方法
减少生成的桶数:降低 terms 聚合的 size,放宽 date_histogram 的间隔,删除不必要的嵌套聚合。如果需要大量结果,用 composite 聚合分页获取。提高限制应作为最后手段,并且存在内存风险:可以用 PUT _cluster/settings 修改 search.max_buckets,但要谨慎。
同一数据库的其他条目
- 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(此文档需要 routing 值)
- shard_lock_obtain_failed_exceptionObtaining shard lock timed out(获取分片锁超时)
- parsing_exceptionFailed to parse the search request / query DSL(无法解析搜索请求/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(已超出字段总数限制)