In the following range query:
"gte": "now/d",
"lte": "now/d"
The gte value would be (eg) 2017-01-18 00:00:00 and the lte value would be 2017-01-18 23:59:59.
However, the rounding should not be based solely on the now/d but should include other adjustments, eg:
"gte": "now/d+1h",
"lte": "now/d+2h"
The gte value is as expected 2017-01-18 01:00:00 but the lte value is now 2017-01-19 01:59:59.
In other words the gap is 25 hours instead of 1 hour. The logic today is:
now down to the daylte, add 24 hours - 1ms+2hInstead the logic should be:
now down to the day+2hlte and the resolution is hours, add 60 min - 1msHey @clintongormley, what the label adoptme means? Maybe to start to contribute to elasticsearch?
@dadoonet, thanks 馃憤
Sounds good. To understand it correctly logic should be
"gte": "now/d" 2017-01-18 00:00:00
"lte": "now/d" 2017-01-18 23:59:59
"gte": "now/d+1h" 2017-01-18 01:00:00
"lte": "now/d+2h" 2017-01-18 01:59:59
"gte": "now/d+1m" 2017-01-18 00:01:00
"lte": "now/d+2m" 2017-01-18 00:01:59
Discussed in FixItFriday. We've decided that we want to keep the lte adjustment and to fix it to follow the following rules:
lte adjustment only happens if rounding appears in the date math expression, eg now/d or 2017-01-01 14:53:12||/h+2h +10m) etclte adjustment, For example:
lte: now/d rounds down to midnight, then adds 24 hours minus 1ms lte: now/d+2h rounds down to midnight, adds two hours, then adds 1 hour minus 1 mslte: now/h + 1d rounds down to the nearest hour, adds 24 hours, then adds 1 hour minus 1msThis probably requires a significant rewrite of our date math parser.
Hi @clintongormley
lte: now/d+2h rounds down to midnight, adds two hours, then adds 1 hour minus 1 ms
Do you mean
Hi @clintongormley, do you handle this issue internally or is there a chance to open a PR?
Do you mean
lte: now/d+2h rounds down to midnight, adds two hours, then adds 24 hour minus 1 ms
No, I do mean one hour. Because we've introduced the hour unit into the date maths, we should round at the hour precision, not the day precision.
do you handle this issue internally or is there a chance to open a PR?
Given the fact that we probably need a significant rewrite of the date math parser, I'd say that this is not low hanging fruit and would probably be better handled internally. thanks anyway
cc @elastic/es-search-aggs