Hi,
I have an ES query where i want to search the doc created between 06 AM and 23 PM.
I have add this to my query:
"range": {
"timestamp": {
"format": "strict_hour",
"gte": "06",
"lte": "23"
}
}
But that doesn't work. I receive no results.
Any idea what I do wrong?
thx!
RabBit_BR
(andre.coelho)
November 4, 2022, 10:42am
2
Hello @Soren_vdc
What is the format of the creation date that you added to the documents?
Hi,
Format is strict_date_optional_time:
yyyy-MM-dd'T'HH:mm:ss.SSSZ
br
Sören
RabBit_BR
(andre.coelho)
November 4, 2022, 4:16pm
4
Try this:
{
"query": {
"script": {
"script": {
"source": "doc['date'].value.getHour() >= params.minHour && doc['date'].value.getHour() <= params.maxHour",
"params": {
"minHour": 6,
"maxHour": 23
}
}
}
}
}
system
(system)
Closed
December 2, 2022, 4:16pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.