New policy has an ISM template with index pattern matching existing policy templates

Opensearch 2.3 (relevant - OpenSearch/Dashboard/Server OS/Browser):

Describe the issue:

I am trying to create an ISM policy for index pattern [*logs-bs.cbes-*] with priority 100 and failing with below error. However I didn’t see any policy matching the index pattern already present. When I create the policy with the priority number not present in existing policies it works. I am not sure how these indexes are overlapping ? Could it be an issue with wild card in the index patterns that matching the pattern [*abc-*] in one ISM to index pattern [*def-*] in another ISM ?

{
“error” : {
“root_cause” : [
{
“type” : “index_management_exception”,
“reason” : “New policy ism_policy_opensearch_prim630-uat_cbes has an ISM template with index pattern [*logs-bs.cbes-*] matching existing policy templates, please use a different priority than 100”
}
],
“type” : “index_management_exception”,
“reason” : “New policy ism_policy_opensearch_prim630-uat_cbes has an ISM template with index pattern [*logs-bs.cbes-*] matching existing policy templates, please use a different priority than 100”,
“caused_by” : {
“type” : “exception”,
“reason” : “java.lang.IllegalArgumentException: New policy ism_policy_opensearch_prim630-uat_cbes has an ISM template with index pattern [*logs-bs.cbes-*] matching existing policy templates, please use a different priority than 100”
}
},
“status” : 400
}

The other policies have following index pattern and priority

“priority” : 100,
“index_patterns” : [
“*abc-es-logging-index-*”,
“otel-v1-apm-span-*”
],

“index_patterns” : [
“*logs-bs.couchbase-*”
],
“priority” : 102,

“index_patterns” : [
“*logs-bs.elastic-*”
],
“priority” : 101,

** How to Reproduce this issue**

  1. Create an ISM policy for the pattern “*logs-bs.couchbase-*” and priority 100
  2. Create another ISM policy for the pattern *logs-bs.cbes-* and priority 100

Configuration:

Relevant Logs or Screenshots:

Hi @Rishabht,

Cloud you run the below and share the output:

GET _plugins/_ism/policies

thanks,
mj

As asked please find below

{
  "policies" : [
    {
      "_id" : "ism_policy_opensearch_prim630-uat",
      "_seq_no" : 121144,
      "_primary_term" : 1988,
      "policy" : {
        "policy_id" : "ism_policy_opensearch_prim630-uat",
        "description" : "Move indexes between storage tiers",
        "last_updated_time" : 1720690088603,
        "schema_version" : 16,
        "error_notification" : null,
        "default_state" : "hot",
        "states" : [
          {
            "name" : "hot",
            "actions" : [ ],
            "transitions" : [
              {
                "state_name" : "warm",
                "conditions" : {
                  "min_index_age" : "2d"
                }
              }
            ]
          },
          {
            "name" : "warm",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "warm_migration" : { }
              }
            ],
            "transitions" : [
              {
                "state_name" : "cold",
                "conditions" : {
                  "min_index_age" : "3d"
                }
              }
            ]
          },
          {
            "name" : "cold",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "cold_migration" : {
                  "start_time" : null,
                  "end_time" : null,
                  "timestamp_field" : null,
                  "ignore" : "timestamp"
                }
              }
            ],
            "transitions" : [
              {
                "state_name" : "delete",
                "conditions" : {
                  "min_index_age" : "5d"
                }
              }
            ]
          },
          {
            "name" : "delete",
            "actions" : [
              {
                "retry" : {
                  "count" : 3,
                  "backoff" : "exponential",
                  "delay" : "2h"
                },
                "cold_delete" : { }
              }
            ],
            "transitions" : [ ]
          }
        ],
        "ism_template" : [
          {
            "index_patterns" : [
              "*abc-es-logging-index-*",
              "otel-v1-apm-span-*"
            ],
            "priority" : 100,
            "last_updated_time" : 1720690088603
          }
        ]
      }
    },
    {
      "_id" : "ism_policy_opensearch_prim630-uat_couchbase",
      "_seq_no" : 120922,
      "_primary_term" : 1988,
      "policy" : {
        "policy_id" : "ism_policy_opensearch_prim630-uat_couchbase",
        "description" : "Move indexes between storage tiers",
        "last_updated_time" : 1720684216126,
        "schema_version" : 16,
        "error_notification" : null,
        "default_state" : "hot",
        "states" : [
          {
            "name" : "hot",
            "actions" : [ ],
            "transitions" : [
              {
                "state_name" : "warm",
                "conditions" : {
                  "min_index_age" : "2d"
                }
              }
            ]
          },
          {
            "name" : "warm",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "warm_migration" : { }
              }
            ],
            "transitions" : [
              {
                "state_name" : "cold",
                "conditions" : {
                  "min_index_age" : "3d"
                }
              }
            ]
          },
          {
            "name" : "cold",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "cold_migration" : {
                  "start_time" : null,
                  "end_time" : null,
                  "timestamp_field" : null,
                  "ignore" : "timestamp"
                }
              }
            ],
            "transitions" : [
              {
                "state_name" : "delete",
                "conditions" : {
                  "min_index_age" : "5d"
                }
              }
            ]
          },
          {
            "name" : "delete",
            "actions" : [
              {
                "retry" : {
                  "count" : 3,
                  "backoff" : "exponential",
                  "delay" : "2h"
                },
                "cold_delete" : { }
              }
            ],
            "transitions" : [ ]
          }
        ],
        "ism_template" : [
          {
            "index_patterns" : [
              "*logs-bs.couchbase-*"
            ],
            "priority" : 102,
            "last_updated_time" : 1720684216126
          }
        ]
      }
    },
    {
      "_id" : "ism_policy_opensearch_prim630-uat_elastic",
      "_seq_no" : 80354,
      "_primary_term" : 1987,
      "policy" : {
        "policy_id" : "ism_policy_opensearch_prim630-uat_elastic",
        "description" : "Move indexes between storage tiers",
        "last_updated_time" : 1720684216455,
        "schema_version" : 16,
        "error_notification" : null,
        "default_state" : "hot",
        "states" : [
          {
            "name" : "hot",
            "actions" : [ ],
            "transitions" : [
              {
                "state_name" : "warm",
                "conditions" : {
                  "min_index_age" : "2d"
                }
              }
            ]
          },
          {
            "name" : "warm",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "warm_migration" : { }
              }
            ],
            "transitions" : [
              {
                "state_name" : "cold",
                "conditions" : {
                  "min_index_age" : "3d"
                }
              }
            ]
          },
          {
            "name" : "cold",
            "actions" : [
              {
                "retry" : {
                  "count" : 5,
                  "backoff" : "exponential",
                  "delay" : "1h"
                },
                "cold_migration" : {
                  "start_time" : null,
                  "end_time" : null,
                  "timestamp_field" : null,
                  "ignore" : "timestamp"
                }
              }
            ],
            "transitions" : [
              {
                "state_name" : "delete",
                "conditions" : {
                  "min_index_age" : "5d"
                }
              }
            ]
          },
          {
            "name" : "delete",
            "actions" : [
              {
                "retry" : {
                  "count" : 3,
                  "backoff" : "exponential",
                  "delay" : "2h"
                },
                "cold_delete" : { }
              }
            ],
            "transitions" : [ ]
          }
        ],
        "ism_template" : [
          {
            "index_patterns" : [
              "*logs-bs.elastic-*"
            ],
            "priority" : 101,
            "last_updated_time" : 1720684216455
          }
        ]
      }
    },
    {
      "_id" : "raw-span-policy",
      "_seq_no" : 0,
      "_primary_term" : 1,
      "policy" : {
        "policy_id" : "raw-span-policy",
        "description" : "Managing raw spans for trace analytics",
        "last_updated_time" : 1701781645391,
        "schema_version" : 16,
        "error_notification" : null,
        "default_state" : "current_write_index",
        "states" : [
          {
            "name" : "current_write_index",
            "actions" : [
              {
                "retry" : {
                  "count" : 3,
                  "backoff" : "exponential",
                  "delay" : "1m"
                },
                "rollover" : {
                  "min_size" : "50gb",
                  "min_index_age" : "24h"
                }
              }
            ],
            "transitions" : [ ]
          }
        ],
        "ism_template" : [
          {
            "index_patterns" : [
              "otel-v1-apm-span-*"
            ],
            "priority" : 0,
            "last_updated_time" : 1701781645391
          }
        ]
      }
    },
    {
      "_id" : "ttt",
      "_seq_no" : 12056,
      "_primary_term" : 3,
      "policy" : {
        "policy_id" : "ttt",
        "description" : "log index state management ",
        "last_updated_time" : 1708339892043,
        "schema_version" : 16,
        "error_notification" : null,
        "default_state" : "active",
        "states" : [
          {
            "name" : "active",
            "actions" : [ ],
            "transitions" : [
              {
                "state_name" : "delete",
                "conditions" : {
                  "min_index_age" : "1d"
                }
              }
            ]
          },
          {
            "name" : "delete",
            "actions" : [
              {
                "retry" : {
                  "count" : 3,
                  "backoff" : "exponential",
                  "delay" : "1m"
                },
                "delete" : { }
              }
            ],
            "transitions" : [ ]
          }
        ],
        "ism_template" : [
          {
            "index_patterns" : [
              "sasa-*"
            ],
            "priority" : 0,
            "last_updated_time" : 1708338173522
          }
        ]
      }
    }
  ],
  "total_policies" : 5
}

Hi @Rishabht,

I have run some tests in multiple different versions (including 2.3.0 and up to 2.15.0) and it looks like the first character as “*” trips it (BUG?), you can set it up without the wild card as the first character as per below:

        "ism_template" : [
          {
            "index_patterns" : [
              "logs-bs.cbes-*"
            ],
            "priority" : 100,
        "ism_template" : [
          {
            "index_patterns" : [
              "logs-bs.couchbase-*"
            ],
            "priority" : 100,

I see you already raised it in GitHub (New policy has an ISM template with index pattern matching existing policy templates · Issue #1206 · opensearch-project/index-management · GitHub) - that is the right place to progress.

best,
mj