Hello,
I have an index with a 'creationTime' field of type 'long' and 'not_analyzed' (represents a date as a long value). I'm indexing hundreds of documents per second. When I perform the next query using the following 'creationTime':
creationTime :: 04-12-2015 13:38:53 == 1449232733933
creationTime - refresh_interval (10 seconds) :: 04-12-2015 13:38:43 == 1449232723933
{ "query" : { "bool" : { "filter" : { "range" : { "creationTime": { "lte": 1449232723933 } } }}} }
I get 12308 documents. When I print the min and max 'creationTime' from these documents, then:
TOTAL DOCUMENTS = 12308, [min, max] = [ 04-12-2015 13:37:55, 04-12-2015 13:38:48 ]
So at least I'm getting a document with creationTime = '04-12-2015 13:38:48', when my query specifies that creationTime <= '04-12-2015 13:38:43'
If I change my query to:
{ "query" : { "bool" : { "filter" : { "range" : { "creationTime": { "gte": 1449232723933, "lte": 1449232733933 } } }}} }
That means creationTime between '04-12-2015 13:38:43' and '04-12-2015 13:38:53'
I get 2305 documents. When I print the min and max 'creationTime' from these documents, then:
TOTAL DOCUMENTS = 2305, [min, max] = [ 04-12-2015 13:38:43, 04-12-2015 13:38:53 ]
So works fine.
Am I doing something wrong? For the first case I tried to add "gte":0, "lte":1449232723933, but the result is the same.
Thanks.