Can you automatically manage indices?

There is only an option to enable management manually for specific indices. Is there a way to have new indices automatically join a policy or to automatically add them with a wildcard? If I do it from the management page it just tells me my indices are not managed.

So I believe I figured this out. I applied an index template to fluentd* so that the settings are auto applied that you see in the docs.

PUT _template/template_1
{
  "index_patterns": ["fluentd*"],
  "settings": {
    "opendistro.index_state_management.policy_id": "delete_old"
  }
}
2 Likes

hi @sjs344, I had the same question once Index Management was released.
I’ve tried your trick, but I can’t see my indices which is related to my index template in Managed Indices List. Does it really works, I mean it proceeds with policies?

This only works on newly created indices. Your old ones will have to be added manually. It does work though.

You are right!
But if you update setting in such way, all my other settings will be overriden.

PUT _template/template_1
{
  "index_patterns": ["fluentd*"],
  "settings": {
    "opendistro.index_state_management.policy_id": "delete_old"
  }
}

I’ve tryed to get all template setting first GET _template/template_1 and then add "opendistro.index_state_management.policy_id": "delete_old"
Now it works.
Thanks Sam.

Could you please share your policy configuration "delete_old".

Attached below

{
    "policy": {
        "policy_id": "delete_old",
        "description": "A simple default policy that deletes old indicies.",
        "default_state": "open",
        "states": [
            {
                "name": "open",
                "actions": [
                    {
                        "open": {}
                    }
                ],
                "transitions": [
                    {
                        "state_name": "delete",
                        "conditions": {
                            "min_index_age": "5d"
                        }
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ]
    }
}