你不会是程序猿吧?

nested 聚合怎么排序 报错non single-bucket aggregation

Elasticsearch | 作者 mafa1993 | 发布于2017年10月30日 | 阅读数:6395

{
  "size": 0,
  "aggs": {
    "every": {
      "terms": {
        "field": "origin.e.keyword",
        "order": {
          "content>fil._count": "desc"
        }
      },
      "aggs": {
        "content": {
          "nested": {
            "path": "middle.n"
          },
          "aggs": {
            "fil": {
              "filter": {
                "term": {
                  "middle.n.field.keyword": "eml_to"
                }
              },
                "a": {
                  "top_hits": {
                    "size": 1
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
报错:
"reason": "Invalid terms aggregation order path [content>fil._count]. 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. Sub-path [content] points to non single-bucket aggregation"
已邀请:

exceptions - 。。。

赞同来自: mafa1993

深度度量的聚合要求所有路径上的聚合都是单值聚合。我猜可能nested不是单值的。关键我看文档nested聚合是single bucket, single-bucket和single bucket是不是一个意思我也不太清除。
这个是深度度量聚合的,有点老:https://www.elastic.co/guide/c ... .html 
这个是nested的:
https://www.elastic.co/guide/e ... .html 

这个要邀请大神来回答了

medcl - 今晚打老虎。

赞同来自: mafa1993

文档上有写:Pipeline aggs cannot be used for sorting

LiuYang1

赞同来自:

nested怎么排,我也报一样的错误

要回复问题请先登录注册