# Custom index age logic for ILM policies

**URL:** https://discuss.elastic.co/t/custom-index-age-logic-for-ilm-policies/236371
**Category:** Elastic Stack
**Tags:** ilm-index-lifecycle-management
**Created:** [June 9, 2020, 3:07pm UTC](https://discuss.elastic.co/t/custom-index-age-logic-for-ilm-policies/236371 "2020-06-09T15:07:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Marcin\_Kawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_kawa/32/18327_2.png) [@Marcin\_Kawa](https://discuss.elastic.co/u/Marcin_Kawa)
#### Post date: [June 9, 2020, 3:07pm UTC](https://discuss.elastic.co/t/custom-index-age-logic-for-ilm-policies/236371/1 "2020-06-09T15:07:25Z")

</div>

Hello,

The ILM is great for managing the indexes and keeping the database clean, though upgrading to a new version of Elasticsearch requires re-indexing of almost all of the existing data, e.g. bumping from ELK v6 to ELK v7.

This will cause all your indexes to be recreated with a new `created_at` timestamp and ILM won't work as expected. Moreover it can lead to somehow tragic results when your ILM policy will match the re-indexed data timestamp and a great chunk of your data could be deleted at once.

As @Christian_Dahlqvist mentioned here: [Is it possible change creation\_date on reindexed Indexes to get Life cycle Management to work on old indexes](https://discuss.elastic.co/t/is-it-possible-change-creation-date-on-reindexed-indexes-to-get-life-cycle-management-to-work-on-old-indexes/183773) it would be very useful to add some logic for defining index age based on the data field from the records.

I can see it can be done from the [Curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.7/filtertype_age.html#_field_stats_based_ages) as @theuntergeek mentioned but if I understand correctly, this can't be run automatically.

Is there any chance or plans for introducing this functionality? Or maybe you know any workaround for this issue?

Kind regards,  
Marcin

---

<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 4, 2022, 8:01am UTC](https://discuss.elastic.co/t/custom-index-age-logic-for-ilm-policies/236371/2 "2022-11-04T08:01:46Z")

</div>


