本文介绍了脚本化指标聚合顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在elasticsearch 1.5.0中,我尝试使用scripted_metric结果对聚合存储桶进行排序/排序,但收到以下错误:

In elasticsearch 1.5.0, I try to sort/order the aggregation bucket using scripted_metric result,but receive bellow error:

AggregationExecutionException [无效的术语聚合顺序路径[ custom_script]。条款存储桶只能在子聚合器路径上排序,该子聚合器路径是由路径中的零个或多个单存储桶聚合以及路径末端的最终单个存储桶或指标聚合构成的

AggregationExecutionException[Invalid terms aggregation order path [custom_script]. Terms 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

有什么办法解决这个问题?

is any way to solve this issue?

我的查询是这样的:

"aggs": {
    "mygroup": {
      "terms": {
        "field": "customername",
        "order": {
          "custom_script": "asc"
        }
      },
      "aggs": {
        "custom_script": {
          "scripted_metric": {
            ...
          }
        }
      }
    }
  }


推荐答案

不是,这是当前限制。正在

Nope, it's a current limitation. Being tracked in https://github.com/elastic/elasticsearch/issues/8486

这篇关于脚本化指标聚合顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 21:59