Index Life cycle settings disturbed after setting _index_template

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:

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"

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:

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 :

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:

{
  "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.

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