I am trying to use the rollover api to help create indexes by month. However, the rollover api does not seem to support months as a max_age unit: Failed to parse setting [max_age] with value [1M] as a time value: unit is missing or unrecognized.
Is there a better approach for achieving indexes by month with the rollover api?
I did some asking. It turns out that you need a TimeValue, rather than a DateMath object. This list shows the supported units for TimeValues:
d - days
h - hours
m - minutes
s - seconds
ms - milliseconds
micros - microseconds
nanos - nanoseconds
This makes sense, because how would you calculate a month back? The first of the current month? The one before? 30 days ago? The same day of the month for the month previous (e.g. you're on the 30th of March, and there's no 30th of February)?
Ah, thanks. I was looking for a list like that but had trouble finding it.. I care about the same month. I will probably take a different approach using the automatic index creation with templates. Thanks for the help!
The best thing about rollover is that it supports rolling over based on size or age. If you want completely fixed periods for your indices, sticking with the old and trusted index naming convention might work just as well.
In that case, you might find what you're looking for with Elasticsearch Curator, specifically the period filter. You can combine that with Curator's implementation of the Rollover API, called an action in Curator.
Curator could help you determine the age of an index, and you could use even a 1smax_age, because you'd have vetted the age in the filters already.
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.