📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 8.1-8.9

简而言之,当您在 Elasticsearch 中尝试在同一查询中同时使用 top hits 聚合和时间序列聚合时,会出现此错误。由于复杂性及潜在的性能问题,Elasticsearch 不支持这种组合。要解决此问题,您可以将这两种类型的聚合分离到不同的查询中。或者,您可以重新构建数据或查询,以避免同时需要两种类型的聚合。

日志上下文 #

日志 “Top hits aggregations cannot be used together with time series aggregations” 的类名是 TopHitsAggregatorFactory.java. 我们从 Elasticsearch 源代码中提取了以下内容,供寻求深入背景的人参考:

AggregatorFactories.Builder subFactories;
 Mapmetadata
 ) throws IOException {
 super(name; context; parent; subFactories; metadata);
 if (context.isInSortOrderExecutionRequired()) {
 throw new AggregationExecutionException("Top hits aggregations cannot be used together with time series aggregations");
 }
 this.from = from;
 this.size = size;
 this.explain = explain;
 this.version = version;