3

I upgraded Elasticsearch version 5.4 to 7.1. I have a query work on 5.4 version, but the same query on 7.1 throws an exception.

query malformed, empty clause found

Query :

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

           }
       }
    }
}

The filter is empty because I use condition less term query. Is there any solution?

Thank you in advance.

Polynomial Proton
  • 5,020
  • 20
  • 37
legend_blue
  • 93
  • 10
  • What do you expect with an empty filter section? – Val Oct 04 '19 at 11:37
  • I dont expect anything in many case filter not empty like this { "query": {"match_all": {}} ,"aggs": { "price": { "aggs": { "tt": { "terms": { "field": "platformType" } } }, "filter": { "term": { "isActive": "true" } } } } } ı put ın filter request data but ın some case data comes null – legend_blue Oct 04 '19 at 11:47
  • If you use the filter aggregation, you must always have something in it, math_all or anything – Val Oct 04 '19 at 12:00
  • thank you @Val for your suggestion, I'll try it – legend_blue Oct 04 '19 at 12:33

1 Answers1

5

Empty Clauses were deprecated. Use match_all just like you do in your query clause.

{
    "query": {"match_all": {}}
    ,"aggs": {
       "price": {
           "aggs": {
              "tt": {
                  "terms": {
                     "field": "platformType"
                  }
              }
           },
           "filter": {
                   "match_all": {}
           }
       }
    }
}
Polynomial Proton
  • 5,020
  • 20
  • 37