We have a rollup index with data timestamped to midnight of each day. So today we have data timestamped to midnight yesterday 2019-03-11T00:00:00.00000
CET.
We want to build a visualisation which always shows yesterday's data and thus we want to use now-1d/d
in the query.
When we query the data with the epoch 1552258800000
(Monday, March 11, 2019 12:00:00 AM) we get results:
"range": {
"timestamp.date_histogram.timestamp": {
"gte": 1552258800000,
"format": "epoch_millis"
}
}
However, using relative dates back to yesterday midnight now-1d/d
brings no results:
"range": {
"timestamp.date_histogram.timestamp": {
"gte": "now-1d/d",
"lte": "now"
}
}
Our data (returned in the first example with epoch_millis
) has the following timestamp:
"timestamp.date_histogram.timestamp": 1552258800000,
Interestingly using Kibana the relative query does work and we get the data we want:
Of course, kibana doesn't use now-1d/d
but gte: 1552258800000
so that's kinda frustrating...