# Index ILM policy is not working as desired

**URL:** <https://forum.elastiflow.com/t/index-ilm-policy-is-not-working-as-desired/166>\
**Category:** ElastiFlow Community\
**Tags:** elasticsearch\
**Created:** [September 17, 2024, 8:33am UTC](https://forum.elastiflow.com/t/index-ilm-policy-is-not-working-as-desired/166 "2024-09-17T08:33:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehmet](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.elastiflow.com/mehmet/32/86_2.png) [@Mehmet](https://forum.elastiflow.com/u/Mehmet)\
**Post date:** [September 17, 2024, 8:33am UTC](https://forum.elastiflow.com/t/index-ilm-policy-is-not-working-as-desired/166/1 "2024-09-17T08:33:41Z")

</div>

Hello all,

I found a document which points to setup an ILM policy for elastiflow indexes but when I applied it didn’t worked as I hoped.

> <https://gist.github.com/robcowart/ae40f8f5b22cdaae7f1eb8c5e6ff57dc>

After applying this, elasticsearch gave me this error message :

“index.lifecycle.rollover\_alias XXXX does not point to index”

Anybody can help to find a working solution to setup an ILM policy to delete old indexes ?  
Thank you

Mehmet

---

<div class="post-metadata">

**Author:** ![daniel.harada](https://avatars.discourse-cdn.com/v4/letter/d/d6d6ee/32.png) [@daniel.harada](https://forum.elastiflow.com/u/daniel.harada)\
**Post date:** [September 17, 2024, 11:55am UTC](https://forum.elastiflow.com/t/index-ilm-policy-is-not-working-as-desired/166/2 "2024-09-17T11:55:18Z")

</div>

Which version of ElastiFlow are you running? They typically come with an ILM policy.  
[Are you using ECS](https://docs.elastiflow.com/docs/config_ref/common/output_elasticsearch/#ef_output_elasticsearch_ecs_enable)? If not, this policy won’t work.

Here’s the JSON for the ‘elastiflow’ ILM that comes with ElastiFlow 7.2.2. Since I am using CODEX this ILM policy will be applied to all indices that match the ‘`elastiflow-*-codex-*`’ name pattern.

```auto

PUT _ilm/policy/elastiflow
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "0ms",
        "actions": {
          "rollover": {
            "max_age": "1d",
            "max_primary_shard_size": "20gb"
          }
        }
      },
      "delete": {
        "min_age": "7d",
        "actions": {
          "delete": {
            "delete_searchable_snapshot": true
          }
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.elastiflow.com/system/32/59_2.png) [@system](https://forum.elastiflow.com/u/system)\
**Post date:** [October 17, 2024, 11:56am UTC](https://forum.elastiflow.com/t/index-ilm-policy-is-not-working-as-desired/166/3 "2024-10-17T11:56:07Z")

</div>

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