簡體   English   中英

elasticsearch子聚合失敗

[英]elasticsearch sub-aggregations failing

在ES 2.2上,我正在嘗試以下查詢:

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": {
        "range": {
          "startDate": {
            "gt": "2016-07-01"
          }
        }
      }
    }
  },
  "aggs": {
    "numbera": {
      "terms": {
        "field": "numbera",
        "size": 0,
        "aggs": {
          "some": {
            "avg": {
              "field": "callDuration"
            }
          }
        }
      }
    }
  }
}

出現以下錯誤:

{
    "type": "search_parse_exception",
    "reason": "Unknown key for a START_OBJECT in [numbera]: [aggs].",
    "line": 20,
    "col": 18
}

我不知所措,該查詢出了什么問題?

從查詢中刪除子聚合為我提供了正確的結果。

嵌套的aggs應該與"terms": {...}處於同一級別,而不是嵌套在其下。

"aggs": {
  "numbera": {
    "terms": {
      "field": "numbera",
      "size": 0
    },
    "aggs": {
      "some": {
        "avg": {
          "field": "callDuration"
        }
      }
    }
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM