# Why can't we rename indices?

**URL:** <https://discuss.elastic.co/t/why-cant-we-rename-indices/357011>\
**Category:** Elasticsearch\
**Created:** [April 8, 2024, 7:47pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011 "2024-04-08T19:47:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 8, 2024, 7:47pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/1 "2024-04-08T19:47:13Z")

</div>

Ok, so, I ran into a situation where I really needed to be able to rename my index. Somehow it was created before my template was applied and as a result it was a normal index instead of an alias. Which turned into a giant 300+GB index.

From previous experience I knew that Elasticsearch does not support actual renaming, so I figured out a partial work around. Only partial because I will (or have already) end up losing data due to lack of space. Cloning failed, and I can only reindex some of the data before I (will run) ran out of room.

This whole situation would be far simpler to resolve if I could just rename the index as the target of the alias, make sure the alias/rollover/template is working, and then be done. I'd let ILM go in and roll over the index and deal with all the data stuff it needs to deal with.

I did some searching to see if anyone had addressed my question already, but so far all I've found are posts about "use clone/reindex/aliases" instead. Not anything about WHY.

So, why can't we rename indices?

Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 8, 2024, 8:31pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/2 "2024-04-08T20:31:32Z")

</div>

You can use an alias which is like a renaming.

If renaming would be possible it would not take into account any modification though.

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 8, 2024, 9:42pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/3 "2024-04-08T21:42:29Z")

</div>

Er, yes, I know. I'm not asking "how", or for help. I'm asking "why?" this works the way it works.

As in the reasoning (technical and not) behind why you can't rename an index.

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [May 7, 2024, 4:05pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/4 "2024-05-07T16:05:08Z")

</div>

Er, I'll just post this to give this topic another month, just in case someone wants to answer.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [May 7, 2024, 6:44pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/5 "2024-05-07T18:44:04Z")

</div>

The index to document relationship is immutable and, therefore, can not be renamed.

The index can not be renamed because the index to document relationship is immutable.

_This is the way...._

Maybe someone else will give you a better response but this goes back to the earliest / fundamental concepts in elasticssearch and lucene...

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 7, 2024, 7:08pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/6 "2024-05-07T19:08:00Z")

</div>

In addition to using an alias you can also clone the index into an index with the new name you desire and then delete the original one.

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [May 7, 2024, 8:19pm UTC](https://discuss.elastic.co/t/why-cant-we-rename-indices/357011/7 "2024-05-07T20:19:09Z")

</div>

> [@stephenb](#):
>
> The index to document relationship is immutable and, therefore, can not be renamed.
> 
> The index can not be renamed because the index to document relationship is immutable.

This is actually the kind of answer I was looking for. Thanks!

I was going to ask why it's immutable, but after thinking about it, it makes sense that the relationship is immutable just like an sql table row is immutable to the table it is in.

I think the reason I thought it wasn't like that is because the data storage of the indices doesn't use the index name, just all the random folder names. So I was thinking of the index name as basically an alias to some randomized real name.

> [@Christian\_Dahlqvist](#):
>
> In addition to using an alias you can also clone the index into an index with the new name you desire and then delete the original one.

Er, clone doesn't work when you don't have enough disk space for it. Reindex only sorta worked because i didn't end up saving all the data. I let a lot of it just get deleted.
