# Index clone v.s. ILM

**URL:** https://discuss.elastic.co/t/index-clone-v-s-ilm/304135
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [May 6, 2022, 1:54pm UTC](https://discuss.elastic.co/t/index-clone-v-s-ilm/304135 "2022-05-06T13:54:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![nisow95612](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@nisow95612](https://discuss.elastic.co/u/nisow95612)
#### Post date: [May 6, 2022, 1:54pm UTC](https://discuss.elastic.co/t/index-clone-v-s-ilm/304135/1 "2022-05-06T13:54:25Z")

</div>

Hello nice people of Elasticsearch,

what is the proper way to apply ILM to [cloned indices](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-clone-index.html)?  
I know I can set [`index.lifecycle.origination_date`](https://discuss.elastic.co/t/ilm-creation-date-and-reindexing/297469/3) so ILM knows how old data is,  
but that often causes the index to go through multiple relocations and force-merges.

I assume this is because ILM treats the cloned index as if it was new.  
Is there a way to clone the ILM state along with the index, so this does not happen?

Thank you!

---

<div class="post-metadata">

### Author: ![nisow95612](https://avatars.discourse-cdn.com/v4/letter/n/3d9bf3/32.png) [@nisow95612](https://discuss.elastic.co/u/nisow95612)
#### Post date: [May 13, 2022, 1:27pm UTC](https://discuss.elastic.co/t/index-clone-v-s-ilm/304135/2 "2022-05-13T13:27:53Z")

</div>

Currently I am using this workaround:

- clone with `index.lifecycle.origination_date` set to something benign like `date -d yesterday +%s000` and `number_of_replicas` set to `0` (as of 8.2, clone API can't clone replicas)
- wait for index status green
- read correct ILM state using [Explain lifecycle API | Elasticsearch Guide [8.2] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html)
- force ILM to correct state using [Move to lifecycle step API | Elasticsearch Guide [8.2] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html)
- set actual value of `index.lifecycle.origination_date` and `number_of_replicas`

---

<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: [June 10, 2022, 1:28pm UTC](https://discuss.elastic.co/t/index-clone-v-s-ilm/304135/3 "2022-06-10T13:28:15Z")

</div>

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