Elasticsearch: Broken range queries on "date||epoch_millis" fields in 7.1

Created on 4 Jun 2019  路  3Comments  路  Source: elastic/elasticsearch

After upgrading from 6.8 to 7.1.1 the following query results in error:

{
  "query": {
      "bool": {
        "filter": [
          {
            "range": {
              "create_date": {
                "to": 297276785531,
                "include_upper": true
              }
            }
          }
        ]
     }
  }
}

it used to work before the upgrade. The problem is in include_upper = true, it works if changed to false.

The error message is:

failed to parse date field [297276785531] with format [date||epoch_millis]: [Text '297276785531' could not be parsed, unparsed text found at index 0]

mapping for this field is:

      "create_date": {
        "type": "date",
        "format": "date||epoch_millis"
      }

another example of the same issue, but with include_lower:

{
  "query": {
      "bool": {
        "filter": [
          {
            "range": {
              "create_date": {
                "from": 297276785531,
                "include_lower": false
              }
            }
          }
        ]
     }
  }
}

Again, it works with "include_lower": true

This behavior doesn't affect "date_hour_minute_second_fraction||epoch_millis" fields, the issue seems to be related only to "date||epoch_millis" mapping format.

Elasticsearch version:
Version: 7.1.1, Build: oss/docker/7a013de/2019-05-23T14:04:00.380842Z, JVM: 12.0.1

JVM version:
OpenJDK 64 12.0.1

OS version
4.14.78-coreos

:SearcSearch >bug

Most helpful comment

It is related to https://github.com/elastic/elasticsearch/pull/40100 where I changed the logic for parsing composite date formats (with ||) . I wrongly assumed that formats for round up can not have composite formats.

All 3 comments

Pinging @elastic/es-search

Possibly related to #41160 ?

It is related to https://github.com/elastic/elasticsearch/pull/40100 where I changed the logic for parsing composite date formats (with ||) . I wrongly assumed that formats for round up can not have composite formats.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ppf2 picture ppf2  路  3Comments

makeyang picture makeyang  路  3Comments

clintongormley picture clintongormley  路  3Comments

malpani picture malpani  路  3Comments

ttaranov picture ttaranov  路  3Comments