# Is there an automated solution for the rollover pattern?

**URL:** <https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726>\
**Category:** Elasticsearch\
**Created:** [August 26, 2019, 7:45am UTC](https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726 "2019-08-26T07:45:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SphiaTower](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@SphiaTower](https://discuss.elastic.co/u/SphiaTower)\
**Post date:** [August 26, 2019, 7:45am UTC](https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726/1 "2019-08-26T07:45:53Z")

</div>

Hi there,

As is described in [this post](https://www.elastic.co/blog/managing-time-based-indices-efficiently), the rollover pattern is very effective and can often boost performance if implemented correctly. However, implementing the rollover pattern involves too many steps, some of which are very likely to fail, especially for large indices.

The steps includes at least:

1. create an index pattern for active indices and an alias for the latest active index
2. create an index pattern for inactive indices
3. create an alias for search
4. call the rollover API and set configuration  
And after every rollover
5. set the index read-only and route all shards to a single node
6. shrink the active index to a new inactive index
7. force merge the inactive index to a single segment and flush
8. change the alias for search to include the new inactive index and exclude the old active index
9. delete the old active index
10. increase the number of replicas for the new inactive index

For a large index, some of the steps above might need 30min or even 1 hour to complete. It's difficult to monitor whether these steps succeed or not, and even more difficult to write a failover policy in case that any of the steps above has failed. Also, it's extremely easy to make mistakes if you have multiple different indices all implementing the rollover pattern.

I notice that [this post](https://www.elastic.co/blog/managing-time-based-indices-efficiently) was written in 2016, so is there a mature automated solution in 2019?

Thanks!

---

<div class="post-metadata">

**Author:** ![abdon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdon/32/9195_2.png) [@abdon](https://discuss.elastic.co/u/abdon)\
**Post date:** [August 26, 2019, 8:59am UTC](https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726/2 "2019-08-26T08:59:38Z")

</div>

Yes, there is: it's called Index Lifecycle Management (ILM) - a relatively new feature in the Elastic Stack. [This blog post](https://www.elastic.co/blog/implementing-hot-warm-cold-in-elasticsearch-with-index-lifecycle-management) has a good introduction and [the docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-lifecycle-management.html) are quite extensive.

---

<div class="post-metadata">

**Author:** ![SphiaTower](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@SphiaTower](https://discuss.elastic.co/u/SphiaTower)\
**Post date:** [August 26, 2019, 9:15am UTC](https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726/3 "2019-08-26T09:15:52Z")

</div>

Thank you! Had I known this, I would not have written so many so many jsons 🙂

---

<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:** [September 23, 2019, 9:15am UTC](https://discuss.elastic.co/t/is-there-an-automated-solution-for-the-rollover-pattern/196726/4 "2019-09-23T09:15:53Z")

</div>

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