Error with range query inside "not or"

Elasticsearch version: 2.4.5

JVM version (java -version): 1.8.0_111

Description of the problem including expected versus actual behavior:

Using a range query inside an or inside a not causes an error on 2.4.5, but not on 1.7.1.

Steps to reproduce:

This query works fine:

{
  "filter": {
    "or": [
      { "range": { "value": { "gte": 1, "lt": 3 } } },
      { "range": { "value": { "gte": 5, "lt": 7 } } }
    ]
  }
}

but wrapping the or in a not will cause an error:

{
  "filter": {
    "not": {
      "or": [
        { "range": { "value": { "gte": 1, "lt": 3 } } },
        { "range": { "value": { "gte": 5, "lt": 7 } } }
      ]
    }
  }
}

where the error is a query_parsing_exception with message [or] query does not support [gte].

That doesn't seem accurate because it works fine without the not.

We are trying to upgrade to 2.x and getting this error there. Our existing version is 1.7.1 where there is no error. (The error occurs on both 2.4.5 and 2.0.0.)

We realize or is deprecated, but converting our code to use should/must syntax is a huge amount of work for various reasons, so we'd prefer any other workarounds or suggestions. Thanks!

Note that or has been deprecated as per: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-or-query.html
It has been removed in 5.x series.

Use should then.

There are no real workarounds AFAIK.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.