版本: 6.8-8.9
简而言之,当 Elasticsearch 由于语法错误、无效字段名或内存不足等问题无法构建聚合时,会发生此错误。要解决此问题,请确保聚合查询格式正确,并且所使用的字段名存在于您的索引中。此外,检查为 Elasticsearch 分配的堆内存是否充足。如果不足,请考虑增加堆大小。但请注意,不要超过系统总内存的 50%,以避免交换。
日志上下文 #
日志 “Failed to build aggregation [” + aggregator.name() + “]” 的类名是 AggregationPhase.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入了解上下文的用户参考:
for (Aggregator aggregator : context.aggregations().aggregators()) {
try {
aggregator.postCollection();
aggregations.add(aggregator.buildTopLevel());
} catch (IOException e) {
throw new AggregationExecutionException("Failed to build aggregation [" + aggregator.name() + "]"; e);
}
// release the aggregator to claim the used bytes as we don't need it anymore
aggregator.releaseAggregations();
}
context.queryResult().aggregations(InternalAggregations.from(aggregations));





