# Index lifecycle policy

**URL:** <https://discuss.elastic.co/t/index-lifecycle-policy/377513>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 25, 2025, 8:44am UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513 "2025-04-25T08:44:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frances\_Chu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frances_chu/32/127298_2.png) [@Frances\_Chu](https://discuss.elastic.co/u/Frances_Chu)\
**Post date:** [April 25, 2025, 8:44am UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513/1 "2025-04-25T08:44:37Z")

</div>

I have two types of index in my system:

Index\_A, where I store all documents, with '@timestamp' representing the log injection time to Elasticsearch, and '\_datetime' indicating the log's own timestamp. In order to minimus the number of shards in the system.

I also use Index\_B. Here, I create a new index every day, so documents from the same day are stored in an index named Index\_B\_yyyy.mm.dd.

Now, I am looking to carry out housekeeping tasks.  
Specifically, I want to move logs older than 2 months to a cold tier  
and delete all logs older than 6 months.

Do you have any recommendations on how to achieve this effectively? Can Index Lifecycle Policies be used for this purpose?

---

<div class="post-metadata">

**Author:** ![Alex\_Salgado-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_salgado-elastic/32/103081_2.png) [@Alex\_Salgado-Elastic](https://discuss.elastic.co/u/Alex_Salgado-Elastic)\
**Post date:** [April 25, 2025, 8:27pm UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513/2 "2025-04-25T20:27:28Z")

</div>

Hi @Frances_Chu ,

Based on your scenario, you can likely use Index Lifecycle Management (ILM) for both types of indices, but you'll need different approaches.

Here are some supporting links:

- [Configure a lifecycle policy | Elastic Docs](https://www.elastic.co/docs/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy)
- [Migrate index allocation filters to node roles | Elastic Docs](https://www.elastic.co/docs/manage-data/lifecycle/index-lifecycle-management/migrate-index-allocation-filters-to-node-roles)
- [Tutorial: Automate rollover | Elastic Docs](https://www.elastic.co/docs/manage-data/lifecycle/index-lifecycle-management/tutorial-automate-rollover)
- [Index lifecycle management | Elastic Docs](https://www.elastic.co/docs/manage-data/lifecycle/index-lifecycle-management)

It would also be good, for colleagues' suggestions, if you could mention which version you're using.

---

<div class="post-metadata">

**Author:** ![Frances\_Chu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frances_chu/32/127298_2.png) [@Frances\_Chu](https://discuss.elastic.co/u/Frances_Chu)\
**Post date:** [April 28, 2025, 6:50am UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513/3 "2025-04-28T06:50:30Z")

</div>

Alex

Thank you for the valuable information. It has been very fruitful. My Elasticsearch version is 8.12.0

Frances

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [April 28, 2025, 7:01am UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513/4 "2025-04-28T07:01:14Z")

</div>

ILM can be used to manage retention for time based indices like Index\_B in your use case. ILM can however only delete complete indices, so will not be able to manage retention from a single index where you periodically need to delete documents using delete-by-query, which seems to be the case for your Index\_A.

---

<div class="post-metadata">

**Author:** ![Frances\_Chu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frances_chu/32/127298_2.png) [@Frances\_Chu](https://discuss.elastic.co/u/Frances_Chu)\
**Post date:** [April 28, 2025, 7:20am UTC](https://discuss.elastic.co/t/index-lifecycle-policy/377513/5 "2025-04-28T07:20:17Z")

</div>

It's very clear, thank you very much. I am also considering moving in this direction.
