# Switching policies for an index

**URL:** <https://discuss.elastic.co/t/switching-policies-for-an-index/296200>\
**Category:** Elasticsearch\
**Tags:** ilm-index-lifecycle-management\
**Created:** [February 3, 2022, 2:02pm UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200 "2022-02-03T14:02:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [February 3, 2022, 2:02pm UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/1 "2022-02-03T14:02:45Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/_switching_policies_for_an_index.html#_switching_policies_for_an_index)

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

```auto

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

```

/Angelos

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 3, 2022, 2:22pm UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/2 "2022-02-03T14:22:16Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/set-up-lifecycle-policy.html#switch-lifecycle-policies) for the last version.

---

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [February 3, 2022, 2:44pm UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/3 "2022-02-03T14:44:49Z")

</div>

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

Thank you @leandrojmp!

/Angelos

---

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [February 8, 2022, 9:20am UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/4 "2022-02-08T09:20:23Z")

</div>

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:

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

```

How can I solve that?

/Angelos

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 8, 2022, 1:43pm UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/5 "2022-02-08T13:43:30Z")

</div>

I do not use datastreams or rollover, but you have this information in the same [documentation link](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/set-up-lifecycle-policy.html#apply-policy-manually).

> Do not manually apply a policy that uses the rollover action. Policies that use rollover must be applied by the [index template](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/set-up-lifecycle-policy.html#apply-policy-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.

---

<div class="post-metadata">

**Author:** ![Angelos](https://avatars.discourse-cdn.com/v4/letter/a/4bbf92/32.png) [@Angelos](https://discuss.elastic.co/u/Angelos)\
**Post date:** [February 16, 2022, 9:51am UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/6 "2022-02-16T09:51:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 16, 2022, 9:52am UTC](https://discuss.elastic.co/t/switching-policies-for-an-index/296200/7 "2022-03-16T09:52:13Z")

</div>

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