Skip to content

Broken range queries on "date||epoch_millis" fields in 7.1 #42835

@phil-bl

Description

@phil-bl

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions