# Index Life cycle settings disturbed after setting \_index\_template

**URL:** <https://discuss.elastic.co/t/index-life-cycle-settings-disturbed-after-setting-index-template/335141>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [June 3, 2023, 8:09pm UTC](https://discuss.elastic.co/t/index-life-cycle-settings-disturbed-after-setting-index-template/335141 "2023-06-03T20:09:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zaeemmasood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaeemmasood/32/102383_2.png) [@zaeemmasood](https://discuss.elastic.co/u/zaeemmasood)\
**Post date:** [June 3, 2023, 8:09pm UTC](https://discuss.elastic.co/t/index-life-cycle-settings-disturbed-after-setting-index-template/335141/1 "2023-06-03T20:09:17Z")

</div>

Hello,

I had a template named "30days\_cleanup\_template" set for a particular index which was part of the ILM policy named "cleanup-history". Template was set as follows:

```auto
PUT _template/30days_cleanup_template
{
  "index_patterns": ["asi-*"], 
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 1,
    "index.lifecycle.name": "cleanup-history",
    "index.lifecycle.rollover_alias": "cgbuat-alias"
    }
}

```

"clean-up-history" looks like below"

```auto
PUT _ilm/policy/cleanup-history
{
  "policy": {
    "phases": {
      "hot": {
        "actions": {}
      },
      "delete": {
        "min_age": "30d",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

```

This set up was working fine with 30 days retention in effect.

Lately there was a requirement to introduce \_index\_template to set "highlight.max\_analyzed\_offset" to a higher number on the same index. I went ahead and created the index\_template as follows mentioning no priority:

```auto
PUT /_index_template/template_10844
{
  "index_patterns" : ["asi-*"],
    "template": {
    "settings" : {
      "highlight.max_analyzed_offset" : 3000000
    }
  }
}

```

After the above was set now I see that the ILM policy is not effective on the index any more as seen by using :

```auto
GET asi-2023.06.03/_settings

```

It only shows the output as follows and does not show the index lifecycle settings any more as if that was overwritten:

```auto
{
  "asi-2023.06.03" : {
    "settings" : {
      "index" : {
        "highlight" : {
          "max_analyzed_offset" : "3000000"
        },
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "1",
        "provided_name" : "csi-170844-2023.06.03",
        "creation_date" : "1685750401230",
        "number_of_replicas" : "1",
        "uuid" : "rj5VA3KJRmm7-edU79SHOA",
        "version" : {
          "created" : "7130299"
        }
      }
    }
  }
}

```

Please guide as to how can I avoid ILM policy getting overwritten.

---

<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:** [July 1, 2023, 8:10pm UTC](https://discuss.elastic.co/t/index-life-cycle-settings-disturbed-after-setting-index-template/335141/2 "2023-07-01T20:10:10Z")

</div>

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