# How to rollover index that is ending with date

**URL:** <https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [October 11, 2023, 2:09pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827 "2023-10-11T14:09:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiruni.insyncit.net](https://avatars.discourse-cdn.com/v4/letter/h/c68b51/32.png) [@hiruni.insyncit.net](https://discuss.elastic.co/u/hiruni.insyncit.net)\
**Post date:** [October 11, 2023, 2:09pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/1 "2023-10-11T14:09:33Z")

</div>

Hi,

I have some indices in the cluster that have index names as follows:  
abc-asd-2023-10-09  
abc-asd-2023-10-10  
abc-asd-2023-10-11

There is no function running in the cluster to create daily indices.  
I wanted to add these indices to the ILM policy, but it didn't work. Because ILM is asking for "rollover aliases".  
I got an error:  
illegal\_argument\_exception: setting [index.lifecycle.rollover\_alias] for index [index name] is empty or not defined

So how can I resolve the rollover alias issue?

Thank you..!  
Hiruni

---

<div class="post-metadata">

**Author:** ![iulia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iulia/32/124658_2.png) [@iulia](https://discuss.elastic.co/u/iulia)\
**Post date:** [October 11, 2023, 5:20pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/2 "2023-10-11T17:20:23Z")

</div>

Hi!  
Could you try the explain API to get some more info on [the ILM explain API?](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-error-handling.html)

For your error message:

> You need to explicitly configure this alias _one time_ when you [bootstrap the initial index](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html#ilm-gs-alias-bootstrap).  
> The `index.lifecycle.rollover_alias` setting must be configured for the rollover action to work.  
> Update the index settings to set `index.lifecycle.rollover_alias`

---

<div class="post-metadata">

**Author:** ![hiruni.insyncit.net](https://avatars.discourse-cdn.com/v4/letter/h/c68b51/32.png) [@hiruni.insyncit.net](https://discuss.elastic.co/u/hiruni.insyncit.net)\
**Post date:** [October 11, 2023, 6:09pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/3 "2023-10-11T18:09:57Z")

</div>

Thank you for the reply.

But I want to know how to add the rollover\_alias setting for indices that are created daily.(as follows)  
abc-asd-  
abc-asd-2023-10-09  
abc-asd-2023-10-10  
abc-asd-2023-10-11

I understand the error message, but I wanted to rollover\_alias for above index types.

Thank you..!  
Hiruni

---

<div class="post-metadata">

**Author:** ![iulia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/iulia/32/124658_2.png) [@iulia](https://discuss.elastic.co/u/iulia)\
**Post date:** [October 11, 2023, 6:26pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/4 "2023-10-11T18:26:35Z")

</div>

Alright, sorry for not properly understanding the request 🙂

You mentioned you don't have a function running to create the indices, so I assume no data stream setup? How are the indices created? You can [give them an alias](https://www.elastic.co/guide/en/elasticsearch/reference/current/aliases.html#add-alias) at creation depending of the method?

If you're looking at automation for daily changing indices; [take a look at this process.](https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-index-lifecycle-management.html#getting-started-index-lifecycle-management) You create a lifecycle policy, and a template index with your "abc-asd-\*" format and give it an alias through the wizard.

Is this what you are looking into?

---

<div class="post-metadata">

**Author:** ![hiruni.insyncit.net](https://avatars.discourse-cdn.com/v4/letter/h/c68b51/32.png) [@hiruni.insyncit.net](https://discuss.elastic.co/u/hiruni.insyncit.net)\
**Post date:** [October 16, 2023, 8:25pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/5 "2023-10-16T20:25:30Z")

</div>

Thank you for the reply.

Daily indices are created by a script in internal application and push the data to Elastic cluster.

I can create an index template for these indices. But I cannot add them to the ILM policy. Even I tried to disable the rollover, but it didn't work.

Even if I can create ILM policy for deletion phase, that is also fine for me.

Thank you..!  
Hiruni

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [October 16, 2023, 8:50pm UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/6 "2023-10-16T20:50:47Z")

</div>

Rolling index requires the hard/actual index to end with -000001 when you created the index.

You create the index "abc-asd-2023-10-09-000001" with alias "abc-asd-2023-10-09" pointing to it (part of settings in the create index API payload).

Then when you issue the rollover index api with the rollover criteria, if it's met, then it'll create a new index name "abc-asd-2023-10-09-000002" and point the alias "abc-asd-2023-10-09" to it automatically. So all your future writes to "abc-asd-2023-10-09" will ended up in the index "abc-asd-2023-10-09-000002", etc.

When searching, you just use wildcard to search "abc-asd-2023-10-09\*" for all the documents on that day.

I have not tried ILM so not sure how much of this is applicable. But rolling index is what I explained above.

---

<div class="post-metadata">

**Author:** ![hiruni.insyncit.net](https://avatars.discourse-cdn.com/v4/letter/h/c68b51/32.png) [@hiruni.insyncit.net](https://discuss.elastic.co/u/hiruni.insyncit.net)\
**Post date:** [October 17, 2023, 2:00am UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/7 "2023-10-17T02:00:40Z")

</div>

Hi,

Thank you for the reply.  
Yes, It's not necessary to rollover the index. This index pattern already have daily index. I want to add these indices to ILM policy to automate the index deletion.

Hiruni

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 14, 2023, 2:01am UTC](https://discuss.elastic.co/t/how-to-rollover-index-that-is-ending-with-date/344827/8 "2023-11-14T02:01:17Z")

</div>

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