Hi Alex,
Thanks for looking into this!
From my understanding, you are saying that negative epoch timestamps is only invalid in index time, but still remains supported and valid at query time. Is that correct?
Our mapping for the date looks something like:
PUT test-date/_mapping
{
"properties": {
"sort_date": {
"type": "date",
"format": "yyyy-MM-dd G || yyyy-MM-dd || yyyy-MM || Y G || Y || date_time_no_millis || date_hour_minute_second || epoch_millis"
}
}
}
And in this case, we have run into another issue with epoch_millis. When using the range query, the epoch_millis format does not recognize any epoch_millis values with its last 3 digits being anything other than '000'.
To replicate this, using the mapping posted above and put these docs:
PUT test-date/_doc/1
{
"sort_date": "0001-12-31 AD"
}
PUT test-date/_doc/2
{
"sort_date": "0005-03-12 AD"
}
PUT test-date/_doc/3
{
"sort_date": "0005-03-12 AD"
}
Then run the following query:
GET test-date/_search
{
"query": {
"bool": {
"must": {
"query_string": {
"default_operator": "AND",
"query": "*"
}
},
"filter": {
"bool": {
"must": [
{
"range": {
"sort_date": {
"gte": "-62559940430768",
"lte": "-59492208738460",
"format": "epoch_millis"
}
}
}
]
}
}
}
}
}
We then receive an error saying
failed to parse date field [-62559940430768] with format [epoch_millis]: [failed to parse date field [-62559940430768] with format [epoch_millis]]
However, if I change the last 3 digits of the above numbers to 000, the query works and return results successfully.
Any ideas or suggestions?
Thanks in advance!
Jenna