Skip to content

range query on dates can see small numbers of millis as a year #63680

@nik9000

Description

@nik9000

If you write a date range query with numeric parameters we can interpret them as a year. Check it out:

curl -XDELETE -uelastic:password localhost:9200/test curl -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_doc?refresh -d'{"d": "1970-01-01T00:00:01.010Z"}' curl -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_doc?refresh -d'{"d": "1967-01-01T00:00:00.000Z"}' curl -XPOST -HContent-Type:application/json -uelastic:password localhost:9200/test/_search?pretty -d'{ "query": { "range": { "d": { "gt": 1000 } } } }' 

The 1000 gets turned into a String internally and then we parse it as the year 1000.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions