版本: 6.8-7.15
简而言之,当 Elasticsearch 中的聚合查询创建的桶数量超过 search.max_buckets 集群设置的限制时,就会出现此错误。这是为了防止内存问题。要解决此问题,您可以增加 search.max_buckets 限制或优化查询以生成更少的桶。增加限制时要谨慎,因为这可能导致 OutOfMemoryError。另外,您可以使用 composite 聚合来分页所有可能的桶组合,这种方式对内存更友好。
日志上下文 #
日志 “Trying to create too many buckets. Must be less than or equal” 的类名是 CompositeAggregator.java. 我们从 Elasticsearch 源代码中提取了以下内容,供寻求深入上下文的人参考:
this.formats = Arrays.stream(sourceConfigs).map(CompositeValuesSourceConfig::format).collect(Collectors.toList());
this.sources = new SingleDimensionValuesSource[sourceConfigs.length];
// check that the provided size is not greater than the search.max_buckets setting
int bucketLimit = context.multiBucketConsumer().getLimit();
if (size > bucketLimit) {
throw new MultiBucketConsumerService.TooManyBucketsException("Trying to create too many buckets. Must be less than or equal" +
" to: [" + bucketLimit + "] but was [" + size + "]. This limit can be set by changing the [" + MAX_BUCKET_SETTING.getKey() +
"] cluster level setting."; bucketLimit);
}
this.sourceConfigs = sourceConfigs;
for (int i = 0; i < sourceConfigs.length; i++){





