# New index create by policy DOES NOT APPLY the POLICY

**URL:** <https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 27, 2020, 5:46am UTC](https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900 "2020-04-27T05:46:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DawitCh](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@DawitCh](https://discuss.elastic.co/u/DawitCh)\
**Post date:** [April 27, 2020, 5:46am UTC](https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900/1 "2020-04-27T05:46:35Z")

</div>

The problem I met is the same as the topic.

For more detail is that,

- I create ILM Policy (it should be delete after 2 hours)
- Create index name test-000001 with alias test
- Apply the policy to test-000001
- 1-hour pass it auto-create test-000002, but no policy applies  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/74f40851e54feddd273c2854cd9c44f0b0228bba.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/5/2534bd076172270a6b5148dc7a5f8c3e871dccf0.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/f/af55eda4fbece0e50ac2ff6d0447b1adf4e01db2.png)

Can anyone guide how to use this function?

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [April 29, 2020, 2:06pm UTC](https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900/2 "2020-04-29T14:06:18Z")

</div>

When you created the index, you set the `index.lifecycle.name` setting to the policy you wanted to use, but when the index rolls over, it looks like this isn't being set.

You need to create an index template that matches your index (`test-*`) that adds the `index.lifecycle.name` and any other related settings.

Template documentation is at [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/indices-templates.html)

---

<div class="post-metadata">

**Author:** ![DawitCh](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@DawitCh](https://discuss.elastic.co/u/DawitCh)\
**Post date:** [April 30, 2020, 2:52am UTC](https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900/3 "2020-04-30T02:52:58Z")

</div>

Thanks! It works.

---

<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:** [May 28, 2020, 2:52am UTC](https://discuss.elastic.co/t/new-index-create-by-policy-does-not-apply-the-policy/229900/4 "2020-05-28T02:52:58Z")

</div>

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