Index lifetime policy -> remove link between policy and index template

Hi all,

I was just playing a bit with index lifetime policy in 6.6.2.
As I understand I create a policy and then I add the policy to an index template.

I created it with kibana.

I have following questions:

  • I want to see which index templates are using a specific policy. How can I get this information? Can I filter the index_templates for having an lifetime policy set or is there an API method to see where which policy is used?
  • When I delete a policy, the reference in the index template remains. Shouldn't it be deleted?
  • Is there a way in kibana to remove the link between index template and lifecycle policy?
  • If not, how do I update the index template to get rid of the policy but keep all other template configuration?

Thanks,
Andreas

There is not currently an API to see which indices (or index templates) are using a specific policy. However, you can retrieve the list of all indices (GET _all) or all templates (GET _template) and look at the index.lifecycle.name setting - you can filter the results of those APIs using a script or the jq CLI tool.

You can see which indexes have a certain policy via Kibana by going to the "Index Management" tab and using a search like this in the searchbar: ilm.policy:my-policy (where my-policy is the name of your policy). However, there isn't a UI like this for index templates yet.

When I delete a policy, the reference in the index template remains. Shouldn't it be deleted?

It's possible to have an index or index template set to use a policy that doesn't exist. You might, for example, create an index template first, and then the policy that you want it to use. If an index is set to use a policy that doesn't exist, then ILM won't do anything to that index until a policy with that name is created.

Is there a way in kibana to remove the link between index template and lifecycle policy?

Not at this time. I agree this is something we should improve on!

If not, how do I update the index template to get rid of the policy but keep all other template configuration?

You'll have to retrieve the template, remove the setting index.lifecycle.name, and update the template - see the Index Template docs for more information.

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