Find the reason why policy was not applied

Hello,
I have a curator job that does shrink on my indices. And I have an ISM policy that is intended for these shrunk indices. The same job did shrink for 3 indices of the same type. For 2 of them, the policy was successfully applied and initialized but for one it was not applied. no Errors in the logs, I just saw that this index had Managed by Policy: No on the “Index Management/Indices” page.
here is my ISM policy:

      "policy": {
        "description": "Default policy for shrunk indices",
        "schema_version": 1,
        "error_notification": null,
        "default_state": "cold-search",
        "states": [
          {
            "name": "cold-search",
            "actions": [],
            "transitions": [
              {
                "state_name": "delete",
                "conditions": { "min_index_age": "30d" }
              }
            ]
          },
          {
            "name": "delete",
            "actions": [
              {
                "retry": {
                  "count": 20,
                  "backoff": "constant",
                  "delay": "1h"
                },
                "delete": {}
              }
            ],
            "transitions": []
          }
        ],
        "ism_template": {
          "index_patterns": ["logging*shrink", "aws-logs*shrink"],
          "priority": 5
        }
      }
     }

Index names like below:
aws-logs-000451-shrink
aws-logs-000452-shrink
aws-logs-000453-shrink

for 451 and 453 the policy was applied, but for 452 it was not.

is it possible to figure out why the policy was not applied? Probably some logs?

Hey @andrii,

I’m assuming the 000xxx also represents chronological order? I believe the ISM template logic will match the index to the patterns and confirm if the index was created before the ISM template was updated.

Matching logic is here for the ODFE versions: index-management/ISMTemplateService.kt at 1936fec98caaccdba8aebeab265883859ea267f6 · opendistro-for-elasticsearch/index-management · GitHub

@bowenlan Any logs or anything else andrii can look at to see why it didn’t match the middle index?

thanks @dbbaughe , I guess I found the reason: I had more than 10 policies, and if I recall correctly there is a bug that leads to unpredictable behavior in case when there is more than 10 policies. So we reduced the number of policies and now everything work as expected.