Elasticsearch子聚合,不包括来自父级的密钥

时间:2014-12-10 23:23:53

标签: elasticsearch

我目前正在进行聚合以获得给定字段中的前20个术语以及前5个共同出现的术语。

{
"aggs": {
    "descTerms" : {
        "terms" : {
            "field" : "Desc as Marketed",
            "exclude": "[a-z]{1}|and|the|with",
            "size" : 20
        },
        "aggs" : {
            "innerTerms" : {
                "terms" : {
                    "field" : "Desc as Marketed",
                    "size" : 5
                }
            }
        }
    }
}

}

结果是这样的:

 "key": "bluetooth",
           "doc_count": 11172,
           "innerTerms": {
              "doc_count_error_upper_bound": 0,
              "sum_other_doc_count": 33700,
              "buckets": [
                 {
                    "key": "bluetooth",
                    "doc_count": 11172
                 },
                 {
                    "key": "with",
                    "doc_count": 3827
                 }

我想排除子聚合中的键,因为它总是作为最高结果返回(显然)我似乎无法弄清楚如何这样做。

我想先前看起来像这样:

"key": "bluetooth",
               "doc_count": 11172,
               "innerTerms": {
                  "doc_count_error_upper_bound": 0,
                  "sum_other_doc_count": 33700,
                  "buckets": [
                     {
                        "key": "with",
                        "doc_count": 3827
                     }

0 个答案:

没有答案