# ILM deleted after run

**URL:** <https://discuss.elastic.co/t/ilm-deleted-after-run/325130>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 9, 2023, 10:47am UTC](https://discuss.elastic.co/t/ilm-deleted-after-run/325130 "2023-02-09T10:47:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![laurijssen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laurijssen/32/117021_2.png) [@laurijssen](https://discuss.elastic.co/u/laurijssen)\
**Post date:** [February 9, 2023, 10:47am UTC](https://discuss.elastic.co/t/ilm-deleted-after-run/325130/1 "2023-02-09T10:47:17Z")

</div>

I've created an ILM that deletes data after x days.

```auto
PUT idx*/_settings
{
  "index": {
    "lifecycle": {
      "name": "x-days-policy"
    }
  }
}

```

The data gets deleted only once and then the ILM is removed.

GET idx/\_ilm/explain

```auto
{
  "indices" : {
    "idx" : {
      "index" : "idx",
      "managed" : false
      }
    }
}

```

I want it to work forever of course and not put the ILM manually every time.  
How can I set an ILM on an index so that it stays there forever?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 9, 2023, 1:45pm UTC](https://discuss.elastic.co/t/ilm-deleted-after-run/325130/2 "2023-02-09T13:45:44Z")

</div>

You need to set it on the template of your index, are you using templates for your index?

---

<div class="post-metadata">

**Author:** ![laurijssen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laurijssen/32/117021_2.png) [@laurijssen](https://discuss.elastic.co/u/laurijssen)\
**Post date:** [February 10, 2023, 7:42am UTC](https://discuss.elastic.co/t/ilm-deleted-after-run/325130/3 "2023-02-10T07:42:41Z")

</div>

Dont think so. Ill try and start over with creating the indices based on templates. In kibana there does not seem to be a way to create index through gui so I ended up doing "PUT /myindex"

---

<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:** [March 10, 2023, 7:43am UTC](https://discuss.elastic.co/t/ilm-deleted-after-run/325130/4 "2023-03-10T07:43:23Z")

</div>

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