Switching policies for an index

Hey!

Is there any documentation on switching ilm policies for 7.10.0. I could find only for other versions like here: Switching policies for an index | Elasticsearch Guide [7.4] | Elastic

My question is:
Can I switch ILM policy for an index in version 7.10.0 changing only the lifecycling name like below?



PUT my_index/_settings
{
  "lifecycle.name": "my_other_policy"
}


/Angelos

While this will work, I would say that you should follow the new recommended approach, which is to remove the current policy before setting a new one.

Check the documentation for the last version.

1 Like

Great!
I checked that and I wanted to verify it!

Thank you @leandrojmp!

/Angelos

Hey @leandrojmp !

We are using datastreams in our elastic. We have one template which have all the datastreams.
I want to change the policy of specific datastream.

I tried to remove the policy from a datastream and then add the new one but I have ILM errors:

Index lifecycle error
exception: Concurrent modification of alias [datastream-i-want-to-change-policy-ds] during rollover

How can I solve that?

/Angelos

I do not use datastreams or rollover, but you have this information in the same documentation link.

Do not manually apply a policy that uses the rollover action. Policies that use rollover must be applied by the index template. Otherwise, the policy is not carried forward when the rollover action creates a new index.

I'm not sure it will be possible to do what you want manually.

To solve the errors I removed the ILM policy from all the indices, recreate the policy and applied the new policy to the latest index.
Now the rollover works correctly with the data ingestion.

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