Trying to get from the 1st of the month last year to the last day of the prior month. For example if loading that time range now I would want Feb 1st 2021 to Jan 31st 2022. The From is easy, but having a hard time getting the To right. Any tips would be appreciated
{
"from": "now-12M/M",
"to" : "now/M-1d",
"display": "Last year to end of last month"
}
Forgot to include what it's currently doing when I try this. The hope was that the TO would set it to Feb 1st and then would minus one day to make it Jan 31st, but now that we are in the latter half of the month now/M = Feb 28th - 1d leaving it at Feb 27th. If I do now/M-1M/M then I get Jan 31st, but I imagine this will break as soon as March 1st hits where I'll need it to go back to now/M-1d.
"to" in Date range aggregation does not include equal by default. You can use "to": "now/M" to get range including the last day of the prior month. I'm not shure what will happen at the exact moment of 1st 00:00:00.00000 but it doesn't matter in most cases.
I'm just using it in Kibana's timefilter for a dashboard. Will check back in around the 1st of the month if the "to" starts rounding to the first of the month again instead of the last.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.