Unable to delete replicas on existing indices with ILM

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!

1 Like

Check your syntax [docs], it should be:

PUT /index_name/_settings
{
  "index" : {
    "number_of_replicas" : 0
  }
}
1 Like

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.

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