ISM Policies not getting applied

Here is my ISM policy. This was created on 12th April 2022.

{
    "id": "delete_after_7days",
    "seqNo": 893,
    "primaryTerm": 1,
    "policy": {
        "policy_id": "delete-after-1-week",
        "description": "Delete indices after 1 week",
        "schema_version": 12,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "delete",
                        "conditions": {
                            "min_index_age": "7d"
                        }
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "timeout": "6h",
                        "retry": {
                            "count": 2,
                            "backoff": "exponential",
                            "delay": "20m"
                        },
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "logs*"
                ],
                "priority": 10
            }
        ]
    }
}

I am able to see many indices in the “managed indices”. But none of them are getting deleted.
I have indices from early March. This policy was applied on 12th April. So ideally, every index before 5th April should be deleted right?
But now, nothing has happened. All the indices from March is also there.
Also I checked the settings of an index, and I found like below:

{
  "logs-2022.04.15" : {
    "settings" : {
      "index" : {
        "number_of_shards" : "2",
        "plugins" : {
          "index_state_management" : {
            "auto_manage" : "false"
          }
        },
        "provided_name" : "logs-2022.04.15",
        "creation_date" : "1649980800351",
        "number_of_replicas" : "1",
        "uuid" : "EaxmslB_RfC-w5rjzUZmnQ",
        "version" : {
          "created" : "135238127"
        }
      }
    }
  }
}

What does this index.plugins.index_state_management.auto_manage do?
It is set as false in the index settings.
Can anybody shed some light on this?.

Hi @curiousmind - I’m doing my best to compare your policy to one of the example ones on Policies - OpenSearch documentation - I don’t see too much of a difference.

Have you tried minimizing your policy to avoid the retry and timeout stuff to narrow that portion of it out? You could probably chase down the right flow first by making policies that change states at regular intervals and then adding actions to them later once you’re sure that they’re actually changing states.

Hey @curiousmind,

The auto_manage setting will make it so that index is not taken into account when automatically applying policies to indices. It is set to true when you call remove policy on an index.

The idea being that if you remove a policy from an index that was automatically picked up by ISM… we obviously don’t want to then have ISM go and immediately re-attach a policy to that index (since it compared index patterns and creation dates). So any index w/ that setting set to false would not be automatically managed in the future if it matched a policy’s index template and was created before the policy.

1 Like