# ILM policy created and applied but it's not deleting the data

**URL:** <https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [April 25, 2023, 10:49am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727 "2023-04-25T10:49:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![elasticlog](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@elasticlog](https://discuss.elastic.co/u/elasticlog)\
**Post date:** [April 25, 2023, 10:49am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/1 "2023-04-25T10:49:30Z")

</div>

Hello Experts,

I have created the ILM policy and applied to the index . but still it is not deleting the old file. is there anythin i miss or need to add. Please guide me.

```auto
PUT _ilm/policy/delete-old-indices
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "set_priority": {
            "priority": 100
          }
        }
      },
      "delete": {
        "min_age": "7d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

```

and updated the template and index pattern

```auto
PUT tenant-*/_settings 
{
  "index": {
    "lifecycle": {
      "name": "delete-old-indices"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [April 25, 2023, 10:43pm UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/2 "2023-04-25T22:43:54Z")

</div>

Can you share [an explain[([Explain lifecycle API | Elasticsearch Guide [8.7] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.7/ilm-explain-lifecycle.html)) on one of the indices you think should have been deleted?

---

<div class="post-metadata">

**Author:** ![elasticlog](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@elasticlog](https://discuss.elastic.co/u/elasticlog)\
**Post date:** [April 26, 2023, 4:09am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/3 "2023-04-26T04:09:18Z")

</div>

Hi Warkolm,  
Thank you for the reply.

below is the output of `GET tenant-demo-2023.02.10/_ilm/explain`

```auto
{
  "indices" : {
    "tenant-demo-2023.02.10" : {
      "index" : "tenant-demo-2023.02.10",
      "managed" : true,
      "policy" : "delete-old-indices",
      "lifecycle_date_millis" : 1676031719373,
      "age" : "74.65d",
      "phase" : "hot",
      "phase_time_millis" : 1682416154580,
      "action" : "rollover",
      "action_time_millis" : 1679643611758,
      "step" : "check-rollover-ready",
      "step_time_millis" : 1682416154580,
      "is_auto_retryable_error" : true,
      "failed_step_retry_count" : 2304,
      "phase_execution" : {
        "policy" : "delete-old-indices",
        "phase_definition" : {
          "min_age" : "0ms",
          "actions" : {
            "set_priority" : {
              "priority" : 29
            }
          }
        },
        "version" : 2,
        "modified_date_in_millis" : 1682415870237
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![elasticlog](https://avatars.discourse-cdn.com/v4/letter/e/77aa72/32.png) [@elasticlog](https://discuss.elastic.co/u/elasticlog)\
**Post date:** [April 27, 2023, 9:07am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/4 "2023-04-27T09:07:26Z")

</div>

> [@elasticlog](#):
>
> `1682415870237`

Can someone please help me to understand what exactly  
The ILM policy ready which date to delete indices from below below.

"lifecycle\_date\_millis"  
"phase\_time\_millis"  
"action\_time\_millis"  
"step\_time\_millis"  
"modified\_date\_in\_millis"

---

<div class="post-metadata">

**Author:** ![sudhagar\_ramesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sudhagar_ramesh/32/105673_2.png) [@sudhagar\_ramesh](https://discuss.elastic.co/u/sudhagar_ramesh)\
**Post date:** [April 28, 2023, 8:27am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/5 "2023-04-28T08:27:45Z")

</div>

Hello @elasticlog

The numbers are epoch time format. as per your ILM explain output, indices which are 10th Feb dated will rollover to next phase after 74 days.

lifecycle\_date\_millis - February 10, 2023 5:51:59.373 PM GMT+05:30  
phase\_time\_millis - April 25, 2023 3:19:14.580 PM GMT+05:30  
action\_time\_millis - March 24, 2023 1:10:11.758 PM GMT+05:30  
step\_time\_millis - April 25, 2023 3:19:14.580 PM GMT+05:30

However, you should also be mentioning warm phase as well in your polify. so, the flow should be hot, warm, delete.

For more information refer [this](https://www.elastic.co/blog/troubleshooting-elasticsearch-ilm-common-issues-and-fixes) elastic page.

---

<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 26, 2023, 8:28am UTC](https://discuss.elastic.co/t/ilm-policy-created-and-applied-but-its-not-deleting-the-data/330727/6 "2023-05-26T08:28:00Z")

</div>

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