# ILM phase don't delete indexes, only clean up

**URL:** https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440
**Category:** Elasticsearch
**Tags:** ilm-index-lifecycle-management
**Created:** [January 18, 2021, 2:55pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440 "2021-01-18T14:55:43Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 18, 2021, 2:55pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/1 "2021-01-18T14:55:43Z")

</div>

I cretaed ILM policy for two steps. It's hot and delete.

full template

```auto
PUT _ilm/policy/logstash-f-lb
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "7d"
          },
          "set_priority": {
            "priority": 100
          }
        }
      },
      "delete": {
        "min_age": "1d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }

```

but I still have cleaned index which have size couple Kb. Why they not deleted ?

---

<div class="post-metadata">

### Author: ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)
#### Post date: [January 19, 2021, 4:59am UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/2 "2021-01-19T04:59:17Z")

</div>

Not sure, but it might be related to the rollover action.  
Try to remove it and test.

---

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 19, 2021, 8:25am UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/3 "2021-01-19T08:25:54Z")

</div>

> [@AClerk](#):
>
> remove

remove - cleaned indexes?

---

<div class="post-metadata">

### Author: ![AClerk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aclerk/32/55297_2.png) [@AClerk](https://discuss.elastic.co/u/AClerk)
#### Post date: [January 19, 2021, 11:21pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/4 "2021-01-19T23:21:47Z")

</div>

remove it from the policy.  
Did it work?

---

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 20, 2021, 10:17am UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/5 "2021-01-20T10:17:27Z")

</div>

I found out that you mean.  
I should disable buttom "Enable rollover" in GUI.  
And I should set in delete phase count days which I want collected indexes.  
Then I turn of rollover for hot phase.

```auto
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "set_priority": {
            "priority": 100
          }
        }
      },
      "delete": {
        "min_age": "7d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }

```

and wait 2 hours and nothing

```auto
GET .ds-logstash-startrack-alb-2021.01.12-000002/_ilm/explain
{
  "indices" : {
    ".ds-logstash-startrack-alb-2021.01.12-000002" : {
      "index" : ".ds-logstash-startrack-alb-2021.01.12-000002",
      "managed" : true,
      "policy" : "logstash-startrack-alb",
      "lifecycle_date_millis" : 1611014984815,
      "age" : "1.5d",
      "phase" : "hot",
      "phase_time_millis" : 1611014987822,
      "action" : "rollover",
      "action_time_millis" : 1611015588727,
      "step" : "check-rollover-ready",
      "step_time_millis" : 1611015588727,
      "phase_execution" : {
        "policy" : "logstash-startrack-alb",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "rollover" : {
              "max_age" : "7d"
            },
            "set_priority" : {
              "priority" : 100
            }
          }
        },
        "version" : 3,
        "modified_date_in_millis" : 1610524924771
      }

```

---

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 21, 2021, 2:26pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/6 "2021-01-21T14:26:51Z")

</div>

Not work, I foun out log

```auto
"Caused by: java.lang.IllegalArgumentException: step [{\"phase\":\"hot\",\"action\":\"rollover\",\"name\":\"attempt-rollover\"}] for index [.ds-logstash-startrack-alb-2021.01.14-000001] with policy [logstash-startrack-alb] does not exist",

```

---

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 22, 2021, 10:20am UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/7 "2021-01-22T10:20:37Z")

</div>

New index whith changed ilm policy has output

```auto
{
  "indices" : {
    ".ds-logstash-startrack-alb-2021.01.21-000001" : {
      "index" : ".ds-logstash-startrack-alb-2021.01.21-000001",
      "managed" : true,
      "policy" : "logstash-startrack-alb",
      "lifecycle_date_millis" : 1611187303361,
      "age" : "1.4d",
      "phase" : "hot",
      "phase_time_millis" : 1611187304048,
      "action" : "complete",
      "action_time_millis" : 1611187304245,
      "step" : "complete",
      "step_time_millis" : 1611187304245,
      "phase_execution" : {
        "policy" : "logstash-startrack-alb",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "set_priority" : {
              "priority" : 100
            }
          }
        },
        "version" : 4,
        "modified_date_in_millis" : 1611138445471

```

which dosen't have information about rollover as:

```auto
      "action" : "rollover",
      "step" : "check-rollover-ready",

```

and etc.  
I think that new ilm policy whitout rollover action will work fine when will faced with index without rollover settings.  
But how now fixed problems with indexes which contain rollover settings and can't be deleted?

---

<div class="post-metadata">

### Author: ![zakabluk](https://avatars.discourse-cdn.com/v4/letter/z/8baadc/32.png) [@zakabluk](https://discuss.elastic.co/u/zakabluk)
#### Post date: [January 27, 2021, 12:12pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/8 "2021-01-27T12:12:09Z")

</div>

New ilm policy will work with new indexes which created with changed ilm at index template. If we will do change from old to new ilm policy in every index this will result an error.

---

<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: [February 24, 2021, 12:12pm UTC](https://discuss.elastic.co/t/ilm-phase-dont-delete-indexes-only-clean-up/261440/9 "2021-02-24T12:12:15Z")

</div>

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