I have a bunch of indexed documents, each of which have a startTime
field which is a date. I want to query for all documents after 9 PM, regardless of what day they are on. In my production setup, I have groovy scripts disabled for security reasons, so I'm looking to get through this using Lucene expressions. This was my original attempt, which used groovy scripts...
{
"size": 50,
"query": {
"bool": {
"filter": {
"script": {
"script": "doc['startTime'].getHourOfDay() > 21"
}
}
}
}
}
How do I craft a similar query using Lucene expressions? I can see that we should be able to access getHourOfDay()
on documents, but I can't find any solid examples of filtering by hour without using groovy scripts.