Elasticsearch空过滤器聚合

时间:2019-10-04 11:33:21

标签: elasticsearch elasticsearch-aggregation

我将Elasticsearch5.4升级到7.1。我有一个针对5.4版本的查询,但是针对7.1的同一查询引发了异常。

  

查询格式错误,找到空子句

查询:

{
    "query": {"match_all": {}}
    ,"aggs": {
       "price": {
           "aggs": {
              "tt": {
                  "terms": {
                     "field": "platformType"
                  }
              }
           },
           "filter": {

           }
       }
    }
}

该过滤器为空,因为我使用条件较少项查询。有什么解决办法吗?

谢谢。

1 个答案:

答案 0 :(得分:1)

Empty Clauses were deprecated。像在match_all子句中一样使用query

{
    "query": {"match_all": {}}
    ,"aggs": {
       "price": {
           "aggs": {
              "tt": {
                  "terms": {
                     "field": "platformType"
                  }
              }
           },
           "filter": {
                   "match_all": {}
           }
       }
    }
}