ISM Policies does not take effect in DataStream indexes managed by index Template

Versions OpenSearch and Dashboard v3.1.0 - Browser Chrome (137.0.7151.69)

Describe the issue: ISM Policies does not take effect in DataStream indexes managed by index Template.

Configuration:

I am running a cluster deployed by OpenSearch Operator. I am ingesting logs from Logstash to OpenSearch cluster with no problems.

I Created a Index Template to assing all DataStream that will be created with a particular index pattern.

The indexes were created and if I check the settings for every one I can confirm that the key
”opendistro.index_state_management.policy_id” is populated with the correct value, but the rollover operation does not occur, and I dont know if this is a bug, because when I call the explain API for ISM policy the result for a DataStream indexes is null.

This is very confusing, because in the settings API call for the index the value is returned.

Relevant Logs or Screenshots:

Policie : my-ism-policy (Rollover when 1mb is reached)

{

    "id": "my-ism-policy",

    "seqNo": 11747,

    "primaryTerm": 2,

    "policy": {

        "policy_id": "my-ism-policy",

        "description": "Rollover para os indices app-logs* com 1mb",

        "last_updated_time": 1754330739631,

        "schema_version": 24,

        "error_notification": null,

        "default_state": "hot",

        "states": [

            {

                "name": "hot",

                "actions": [

                    {

                        "retry": {

                            "count": 3,

                            "backoff": "exponential",

                            "delay": "1m"

                        },

                        "rollover": {

                            "min_size": "1mb",

                            "copy_alias": false

                        }

                    }

                ],

                "transitions": []

            }

        ],

        "ism_template": null

    }

}

Index Templates: my-data-stream-template and my-data-stream-template-3 ( I tried the first one using opendistro.index_state_management.policy_id and the other one using plugins.index_state_management.policy_id)

GET _index_template/my-data-stream-template
{
  "index_templates": [
    {
      "name": "my-data-stream-template",
      "index_template": {
        "index_patterns": [
          "my-data-stream-*"
        ],
        "template": {
          "settings": {
            "index": {
              "opendistro": {
                "index_state_management": {
                  "policy_id": "my-ism-policy"
                }
              }
            }
          }
        },
        "composed_of": [],
        "priority": 100,
        "data_stream": {
          "timestamp_field": {
            "name": "@timestamp"
          }
        }
      }
    }
  ]
}
GET _index_template/my-data-stream-template-3
{

    "index_templates": [

        {

            "name": "my-data-stream-template-3",

            "index_template": {

                "index_patterns": [

                    "my-data-stream-3*"

                ],

                "template": {

                    "settings": {

                        "index": {

                            "plugins": {

                                "index_state_management": {

                                    "policy_id": "my-ism-policy"

                                }

                            }

                        }

                    }

                },

                "composed_of": [],

                "priority": 90,

                "data_stream": {

                    "timestamp_field": {

                        "name": "@timestamp"

                    }

                }

            }

        }

    ]

}

Index Settings: Showing that the ism policy was inherited from index template

GET .ds-my-data-stream-3-app-logs-hml-integradorproducao-000001/_settings
{
  ".ds-my-data-stream-3-app-logs-hml-integradorproducao-000001": {
    "settings": {
      "index": {
        "replication": {
          "type": "DOCUMENT"
        },
        "opendistro": {
          "index_state_management": {
            "policy_id": "my-ism-policy"
          }
        },
        "hidden": "true",
        "number_of_shards": "1",
        "provided_name": ".ds-my-data-stream-3-app-logs-hml-integradorproducao-000001",
        "creation_date": "1754338757630",
        "number_of_replicas": "1",
        "uuid": "G_Bk0zsiSW23uspWgWX5Nw",
        "version": {
          "created": "137227827"
        }
      }
    }
  }
}

Explain: Showing that ism policy is null

GET _plugins/_ism/explain/.ds-my-data-stream-3-app-logs-hml-integradorproducao-000001
{
  ".ds-my-data-stream-3-app-logs-hml-integradorproducao-000001": {
    "index.plugins.index_state_management.policy_id": null,
    "index.opendistro.index_state_management.policy_id": null,
    "enabled": null
  },
  "total_managed_indices": 0
}

@VitorProtasio Was this ever working for you in older versions?

Hello, @pablo

I am migrating my workload from OpenDistro V7.10.0 (yes, quite an old version) to OpenSearch v3.1.0. This is my first time using OpenSearch.

In my old OpenDistro environment, I was unable to use Data Streams because this feature was not available there, I used to create my templates using the old template API (_template), which worked fine for me.
Now, in the new version of OpenSearch, I am trying to use the `index_template` API with Data Stream functionality. However, I also tried a new approach: creating an `index_template` without the Data Stream feature. In both cases, I received the same result.

New index_template (Without DataStream feature)

GET _index_template/app-logs-hml-li4254cell01-controleproducaoear
{
  "index_templates": [
    {
      "name": "app-logs-hml-li4254cell01-controleproducaoear",
      "index_template": {
        "index_patterns": [
          "app-logs-hml-li4254cell01-controleproducaoear"
        ],
        "template": {
          "settings": {
            "index": {
              "number_of_shards": "1",
              "number_of_replicas": "0",
              "opendistro": {
                "index_state_management": {
                  "policy_id": "applogs_rollover_10mb",
                  "rollover_alias": "app-logs-hml-li4254cell01-controleproducaoear"
                }
              }
            }
          }
        },
        "composed_of": [],
        "priority": 100
      }
    }
  ]
}

New Index Settings

GET app-logs-hml-li4254cell01-controleproducaoear/_settings
{
  "app-logs-hml-li4254cell01-controleproducaoear": {
    "settings": {
      "index": {
        "replication": {
          "type": "DOCUMENT"
        },
        "opendistro": {
          "index_state_management": {
            "policy_id": "applogs_rollover_10mb",
            "rollover_alias": "app-logs-hml-li4254cell01-controleproducaoear"
          }
        },
        "number_of_shards": "1",
        "provided_name": "app-logs-hml-li4254cell01-controleproducaoear",
        "creation_date": "1754495349113",
        "number_of_replicas": "0",
        "uuid": "HcfaOhGuSqKON2d-TXLBOw",
        "version": {
          "created": "137227827"
        }
      }
    }
  }
}

ISM Police

{
    "id": "applogs_rollover_10mb",
    "seqNo": 0,
    "primaryTerm": 1,
    "policy": {
        "policy_id": "applogs_rollover_10mb",
        "description": "Rollover para os indices app-logs* com 10mb",
        "last_updated_time": 1753989426608,
        "schema_version": 24,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "rollover": {
                            "min_size": "10mb",
                            "copy_alias": false
                        }
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": null
    }
}

Explain Police with null result

GET _plugins/_ism/explain/app-logs-hml-li4254cell01-controleproducaoear
{
  "app-logs-hml-li4254cell01-controleproducaoear": {
    "index.plugins.index_state_management.policy_id": null,
    "index.opendistro.index_state_management.policy_id": null,
    "enabled": null
  },
  "total_managed_indices": 0
}

Hey Guys,

Someone to help-me ?

Thanks in advanced,
Vitor Protasio

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