# ILM not deleting upcoming indices(ILM not working)

**URL:** https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [April 22, 2022, 10:16am UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009 "2022-04-22T10:16:10Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jisha](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jisha](https://discuss.elastic.co/u/jisha)
#### Post date: [April 22, 2022, 10:16am UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/1 "2022-04-22T10:16:10Z")

</div>

Hi, I am using elk 8.0.0v in windows. Data deletion of upcoming indices is not happening for the time duration setted in ILM (ex:5mints (for testing purpose)).I have created ILM template and assigned metricbeat 8.0.0.  
There is no error showing in kibana and Elasticsearch node logs.

This is the source code i implemented (it is not working):

```auto
PUT _ilm/policy/metricbeat
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "5m",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}

```

Please help or suggest any solution.

Thanks

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [May 5, 2022, 5:12pm UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/2 "2022-05-05T17:12:55Z")

</div>

1st that is not a valid ILM with Hot and Delete only works _after_ the rollover happens you have no rollover for hot. I would recommend using the UI in Kibana and look at what the request looks like

```auto
PUT _ilm/policy/test
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {
          "rollover": {
            "max_age": "1d",
            "max_primary_shard_size": "50gb"
          },
          "set_priority": {
            "priority": 100
          }
        },
        "min_age": "0ms"
      },
      "delete": {
        "min_age": "1d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

```

2nd ILM is not designed for time frame on the order of minutes or exact bytes.... the background task runs every 10 mins or so. Think of ILM is meant to run on "Hours and Gigabytes" it is not mean to be exact at the minute or byte...

In the real world at scale of size and time it works as designed.

We see this often people want to test ILM with tiny shard sizes and minutes and wonder why it does not execute on the exact minute and size... it will not you can put in 1 hour or so and it will be close... etc.

---

<div class="post-metadata">

### Author: ![ibra\_013](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibra_013/32/104827_2.png) [@ibra\_013](https://discuss.elastic.co/u/ibra_013)
#### Post date: [May 5, 2022, 5:25pm UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/3 "2022-05-05T17:25:19Z")

</div>

Hi Stephen,

The rollover needs `max_primary_shard_size` and `max_age` on the ILM definition to to trigger .

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [May 5, 2022, 5:28pm UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/4 "2022-05-05T17:28:32Z")

</div>

> [@ibra\_013](#):
>
> The rollover needs `max_primary_shard_size` and `max_age` on the ILM definition to to trigger .

Not sure if that is a question?...

You need at least one of them but can also use both and rollover will happen when the first one is met.

---

<div class="post-metadata">

### Author: ![ibra\_013](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ibra_013/32/104827_2.png) [@ibra\_013](https://discuss.elastic.co/u/ibra_013)
#### Post date: [May 5, 2022, 5:35pm UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/5 "2022-05-05T17:35:06Z")

</div>

sorry stephen, i forget ? mark, yes it was a question.

---

<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 2, 2022, 5:35pm UTC](https://discuss.elastic.co/t/ilm-not-deleting-upcoming-indices-ilm-not-working/303009/6 "2022-06-02T17:35:38Z")

</div>

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