Reputation: 41
In Elastic-search range query , timestamp is in this 2019-08-28T08:57:04.749Z formate, when execute the following query it throws a error "Unrecognized chars at the end of [2019-08-28T08:57:04.749Z- 1h]. how can we minus 1 hr in lte value?
{
"query": {
"range" : {
"@timestamp" : {
"gte": "2015-03-20T01:21:00.01Z",
"lte": "2015-03-20T01:12:00.04Z-1h"
}
}
}
Upvotes: 0
Views: 1072
Reputation: 217254
The right way to do it is by adding a double pipe, like this:
{
"query": {
"range" : {
"@timestamp" : {
"gte": "2015-03-20T01:21:00.01Z",
"lte": "2015-03-20T01:12:00.04Z||-1h"
}
}
}
However, you should note that your query won't return anything, because the to date is earlier than the from date.
Upvotes: 2