Multiple ILM Policies on same index: Which one applies?

If I define multiple ILM Policies on patterns that match the same index, which one applies? Does the one with the lower "min_age" apply or the one which was created first? Or anything else?

Example:
If I now create the index "test-index" it is matched by both policies. Is it deleted after 1h or 2h?

        PUT _ilm/policy/ilm_1h
    {
        "policy": {
            "phases": {
                "hot": {
                    "min_age": "0ms",
                    "actions": {
                        "set_priority": {
                            "priority": 100
                        }
                    }
                },
                "delete": {
                    "min_age": "1h",
                    "actions": {
                        "delete": {}
                    }
                }
            }
        }
    }

    PUT _ilm/policy/ilm_2h
    {
        "policy": {
            "phases": {
                "hot": {
                    "min_age": "0ms",
                    "actions": {
                        "set_priority": {
                            "priority": 100
                        }
                    }
                },
                "delete": {
                    "min_age": "2h",
                    "actions": {
                        "delete": {}
                    }
                }
            }
        }
    }



    PUT _template/template_1h
    {
    	"index_patterns": ["test-*"],
    	"settings": {
    		"index.lifecycle.name": "ilm_1h"
    	}
    }

    PUT _template/template_2h
    {
    	"index_patterns": ["test-index"],
    	"settings": {
    		"index.lifecycle.name": "ilm_2h"
    	}
    }

That would depend on the order that the templates were applied. In order to make this deterministic, you'll need to add the "order" parameter in each template so that they can be explicitly merged in a particular order.

1 Like

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