Hello,
I'm preparing bus timetable and I got a problem with query.
My mapping (below) has hour
field in hour_minute
format.
{
"stops": {
"properties": {
"dayType": {
"type": "string"
},
"stopNumber": {
"type": "string"
},
"hour": {
"format": "hour_minute",
"type": "date"
},
"stopDetails": {
"type": "string"
},
"location": {
"type": "geo_point"
},
"lineNumber": {
"type": "string"
}
}
}
}
I would like to have the times starting from now
and then sort them ascending but querying from now doesn't work. I know it's a problem with timestamp that stays behind now
so I started passing time value like 22:34
and it works but returns documents only to 23:59.
I would really love my query to return documents, say from 22:34 to 2:15 but I don't know how to do it.
{
"query": {
"constant_score": {
"filter": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"range": {
"hour": {
"gte": "now",
"format": "HH:mm",
"include_lower": true,
"include_upper": true
}
}
}
]
}
}
]
}
}
}
}
}