# Delete index older than a week

**URL:** <https://discuss.elastic.co/t/delete-index-older-than-a-week/320737>\
**Category:** Elasticsearch\
**Created:** [December 8, 2022, 5:33am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737 "2022-12-08T05:33:58Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Venkata\_Raja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkata_raja/32/114264_2.png) [@Venkata\_Raja](https://discuss.elastic.co/u/Venkata_Raja)\
**Post date:** [December 8, 2022, 10:10am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737/21 "2022-12-08T10:10:01Z")

</div>

All will depend on index pattern that you have mentioned while creating index template, IF your logstash has created the index with matching pattern then all these settings you have specified in template will be attached automatically

---

<div class="post-metadata">

**Author:** ![Neelam\_Zanvar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neelam_zanvar/32/103116_2.png) [@Neelam\_Zanvar](https://discuss.elastic.co/u/Neelam_Zanvar)\
**Post date:** [December 8, 2022, 10:12am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737/22 "2022-12-08T10:12:47Z")

</div>

ok. so it wont delete with the indices created till now? logstash is creating the indices whose patterns ive added in the template. also do i need to add the ilm\_policy to logstash config file also?

---

<div class="post-metadata">

**Author:** ![Venkata\_Raja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkata_raja/32/114264_2.png) [@Venkata\_Raja](https://discuss.elastic.co/u/Venkata_Raja)\
**Post date:** [December 8, 2022, 10:24am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737/23 "2022-12-08T10:24:57Z")

</div>

No Need to add ilm to logstash config, And ILM will be applied to new indices only. You have to apply ILM manually to old indices.

```auto
PUT <index_name>
{
  "settings": {
    "index.lifecycle.name": "<policy_name>" 
  }
}

```

---

<div class="post-metadata">

**Author:** ![Neelam\_Zanvar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neelam_zanvar/32/103116_2.png) [@Neelam\_Zanvar](https://discuss.elastic.co/u/Neelam_Zanvar)\
**Post date:** [December 8, 2022, 10:26am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737/24 "2022-12-08T10:26:15Z")

</div>

ok thank you so much for your time and quick response!

---

<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:** [January 5, 2023, 10:26am UTC](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737/25 "2023-01-05T10:26:46Z")

</div>

Closed on January 5, 2023, 10:26am UTC

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

[Previous page](https://discuss.elastic.co/t/delete-index-older-than-a-week/320737.md?page=1)
