Index is starting policy again with shrink action

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): 2.4.1

Describe the issue: My intention is to create a ISM policy that will shrink and index and continue it’s life in policy, but after the shrink action new renamed index is going back to the start of the policy (hot phase).

Configuration:

 "default_state": "hot",
    "states": [
        {
            "name": "hot",
            "actions": [
                {
                    "retry": {
                        "count": 3,
                        "backoff": "exponential",
                        "delay": "1m"
                    },
                    "rollover": {
                        "min_doc_count": 5,
                        "min_index_age": "20m",
                        "min_primary_shard_size": "200mb"
                    }
                }
            ],
            "transitions": [
                {
                    "state_name": "cold",
                    "conditions": {
                        "min_index_age": "10m"
                    }
                }
            ]
        },
        {
            "name": "cold",
            "actions": [
                {
                    "retry": {
                        "count": 3,
                        "backoff": "exponential",
                        "delay": "1m"
                    },
                    "allocation": {
                        "require": {
                            "data": "cold"
                        },
                        "include": {},
                        "exclude": {},
                        "wait_for": false
                    }
                },
                {
                    "retry": {
                        "count": 3,
                        "backoff": "exponential",
                        "delay": "1m"
                    },
                    "shrink": {
                        "num_new_shards": 1,
                        "target_index_name_template": {
                            "source": "{{ctx.index}}_shrunken",
                            "lang": "mustache"
                        },
                        "force_unsafe": false
                    }
                }
            ],
            "transitions": [
                {
                    "state_name": "delete",
                    "conditions": {
                        "min_index_age": "40m"
                    }
                }
            ]
        },
        {
            "name": "delete",
            "actions": [
                {
                    "retry": {
                        "count": 3,
                        "backoff": "exponential",
                        "delay": "1m"
                    },
                    "delete": {}
                }
            ],
            "transitions": []
        }
    ]

Relevant Logs or Screenshots:

I think the reason is that the new shrunken index has the same prefix with the original index, and the new shrunken index’s name hits the ISM template pattern defined in your policy, so the policy will be applied to the new shrunken index automatically. You can modify the target_index_name_template.source field in the shrink action of you policy to make the new index do not have same prefix with the original index and then no policy will be applied.

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