Below query when executed in Elasticsearch version 1.x
Was considering documents created after 6/15/2016 that is documents which have time beyond 12 Am for the date 6/15/2016.It was considering documents till 6/15/2016 23:59:59.999 .
But with new version of ES 2.x the range query has stopped considering documents which have time beyond 12 Am for the date 6/15/2016. Now It is considering documents till 6/14/2016 23:59:59.999.
What exactly changed here?
{
"from": 0,
"size": 10,
"sort": [
{
"PRONumber.sort": {
"order": "desc"
}
}
],
"query": {
"bool": {
"must": [
{
"match": {
"BOLNumber": {
"query": "7861254",
"analyzer": "gtz_search_analyzer",
"operator": "and"
}
}
},
{
"range": {
"CreatedDate": {
"gte": "1753-01-01",
"lte": "2016-06-15"
}
}
}
]
}
}
}
In elasticsearch 2.x for the query in the OP the upper-limit is 6/15/2016 00:00:00.000
and not 6/14/2016 23.59.59.999
.
From the documentation it follows that you would need to explictly specify in the query to round-up
by day as shown in the example below
Example:
{
"from": 0,
"size": 10,
"sort": [
{
"PRONumber.sort": {
"order": "desc"
}
}
],
"query": {
"bool": {
"must": [
{
"match": {
"BOLNumber": {
"query": "7861254",
"analyzer": "gtz_search_analyzer",
"operator": "and"
}
}
},
{
"range": {
"CreatedDate": {
"gte": "1753-01-01",
"lte": "2016-06-15||/d"
}
}
}
]
}
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments