Weird issue with date sort

(Nicolas F) #1


I have an issue with date field.

With this queries:


PUT ds3

POST ds3/ds2/ds2%23%230%23%23urn%3Adomain%3Asensors%3A1

POST ds3/ds2/ds2%23%4607182418800017408%23%23urn%3Adomain%3Asensors%3A1

POST ds3/ds2/_search

   "size": 1,
    "sort" : [
        { "timestamp" : {"order" : "asc"}}

I expect the sort of the values done on timestamp to return the timestamp 0. But it return the timestamp 1000.

I'm using ElasticSearch 6.3.0

Do you know why ?


(David Pilato) #2

I don't know TBH. Could you try with more recent timestamps to see if this reproduces?

(Nicolas F) #3

The issue is that it won't work with timestamps < 1000

I have to fix this because I must follow some generic unit test for storage system that use time stamps from 0 to 10000

(David Pilato) #4

Why not using a number instead of a date then?

(Nicolas F) #5

Yes this is a workaround.

Is that a bug of ElasticSearch or not ?

(David Pilato) #6

Might be. I think @jpountz already answered such a question in the past but I don't recall exactly. Adrien, could you confirm if this is an "expected bug"? :slight_smile:

(Nicolas F) #7


For the record,

Solved by specifying the time format to epoch_millis (in both mapping and in query)

Then epoch_millis must be in the following millisecond bounds:

private static final long MIN_DATE_EPOCH = -62138538000000L;
private static final long MAX_DATE_EPOCH = 253336460400000L;



(system) #8

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