# Unable to delete replicas on existing indices with ILM

**URL:** <https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051>\
**Category:** Elasticsearch\
**Created:** [May 31, 2022, 3:32pm UTC](https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051 "2022-05-31T15:32:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhoward](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mhoward](https://discuss.elastic.co/u/mhoward)\
**Post date:** [May 31, 2022, 3:32pm UTC](https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051/1 "2022-05-31T15:32:39Z")

</div>

Hello. I have been trying to implement a change to my ILM where indices moved to the "cold" state will have their replica deleted. They currently have 1 replica. I've already made the change in the Index Lifecycle Policy to set the number of replicas to 0, but none of the existing indices had their replicas deleted. Will this change only apply to indices when they're moved to the cold phase and not to any indices that were already in the cold phase?

I then went into console and tried to manually delete the replicas from the indices.

> PUT /index\_name  
> {  
> "settings": {  
> "number\_of\_replicas": 0  
> }  
> }

However, I received the following error:

> {  
> "error" : {  
> "root\_cause" : [  
> {  
> "type" : "resource\_already\_exists\_exception",  
> "reason" : "index [index\_name/ZjpQ4dqaR4mm2jAOLY7TGA] already exists",  
> "index\_uuid" : "ZjpQ4dqaR4mm2jAOLY7TGA",  
> "index" : "index\_name"  
> }  
> ],  
> "type" : "resource\_already\_exists\_exception",  
> "reason" : "index [index\_name/ZjpQ4dqaR4mm2jAOLY7TGA] already exists",  
> "index\_uuid" : "ZjpQ4dqaR4mm2jAOLY7TGA",  
> "index" : "syslog-old-2021.24"  
> },  
> "status" : 400  
> }

So the error leads to believe the change can't be made on an existing index, which is confusing to me. Is there any way to delete a replica on an existing index, or am I running into a separate problem that is preventing me from doing this?

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![angelo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/angelo/32/61325_2.png) [@angelo](https://discuss.elastic.co/u/angelo)\
**Post date:** [May 31, 2022, 7:42pm UTC](https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051/2 "2022-05-31T19:42:02Z")

</div>

Check your syntax [[docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html)], it should be:

```auto
PUT /index_name/_settings
{
  "index" : {
    "number_of_replicas" : 0
  }
}

```

---

<div class="post-metadata">

**Author:** ![mhoward](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@mhoward](https://discuss.elastic.co/u/mhoward)\
**Post date:** [May 31, 2022, 7:50pm UTC](https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051/3 "2022-05-31T19:50:26Z")

</div>

Thank you. That fixed the issue. Also had an index rollover from warm to cold and the replica deleted. Just need to clean up some old indices and should be good.

---

<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:** [June 28, 2022, 7:51pm UTC](https://discuss.elastic.co/t/unable-to-delete-replicas-on-existing-indices-with-ilm/306051/4 "2022-06-28T19:51:04Z")

</div>

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