Creating index on monthly basis

Is there any way by which we can create index named <prefix>-yyyy.mm on the first day of every month and getting the alias pointed to this newly created index? I learned about date time but that changes the name only when the index rollover take places. I am using Rest High level java client to insert the Json messages into elastic search and kibana for visualization.

Welcome to our community! :smiley:

We'd recommend using ILM to handle that these days.

But the max_age time units list doesnot contains month, right? Is there any setting so that we can trigger rollover on first of the month?

It'd be N days from when the policy first created an index, so that may or may not be the start of the new month.

Is there a reason you want it exactly monthly?

I have one use case where my index name contains the month and year and to store that month data into that month's index only.

You can probably use this as one method

2 Likes

Thanks for the reply.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.