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

版本: 6.8-7.6

简而言之,当 Elasticsearch 聚合的 “order” 字段中指定的路径不正确时,就会发生此错误。这可能是由于拼写错误、字段名不正确或该字段在索引中不存在造成的。要解决此问题,请确保你尝试排序的字段在索引中存在且拼写正确。此外,检查路径的结构是否正确,遵循 “aggregationName.fieldName” 模式。如果该字段是嵌套字段,请确保提供了正确的路径。

日志上下文 #

日志 “Invalid aggregation order path [” 的类名是 AggregationPath.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

if (i < pathElements.size() - 1) {  // we're in the middle of the path; so the aggregator can only be a single-bucket aggregator  if (!(aggregator instanceof SingleBucketAggregator)) {
 throw new AggregationExecutionException("Invalid aggregation order path [" + this +
 "]. Buckets can only be sorted on a sub-aggregator path " +
 "that is built out of zero or more single-bucket aggregations within the path and a final " +
 "single-bucket or a metrics aggregation at the path end. Sub-path [" +
 subPath(0; i + 1) + "] points to non single-bucket aggregation");
 }