# About the implements of alias, addAlias and removeAlias

**URL:** <https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013>\
**Category:** Elasticsearch\
**Created:** [May 18, 2022, 4:05am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013 "2022-05-18T04:05:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xingzhao](https://avatars.discourse-cdn.com/v4/letter/x/258eb7/32.png) [@xingzhao](https://discuss.elastic.co/u/xingzhao)\
**Post date:** [May 18, 2022, 4:05am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013/1 "2022-05-18T04:05:55Z")

</div>

Hello, I would like to ask about the methods of alias, how are addAlias and removeAlias implemented? How do they avoid problems with atomicity among other operations? For example, how to ensure that the alias information is always in the state at the beginning of the operation when performing an operation? Because I'm not very familiar with the code, I can't find the corresponding code. Thanks!

---

<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 18, 2022, 6:01am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013/2 "2022-05-18T06:01:29Z")

</div>

Could you please elaborate on what you are looking to achieve? What are you using aliases for?

---

<div class="post-metadata">

**Author:** ![xingzhao](https://avatars.discourse-cdn.com/v4/letter/x/258eb7/32.png) [@xingzhao](https://discuss.elastic.co/u/xingzhao)\
**Post date:** [May 18, 2022, 6:49am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013/4 "2022-05-18T06:49:59Z")

</div>

I want to use alias for collection and if I directly delete the alias or change the relationship between alias and collections, there will be some atomicity issues. So I want to study the implementations in es.

---

<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 18, 2022, 7:32am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013/5 "2022-05-18T07:32:35Z")

</div>

Each change to an alias requires an update to the cluster state which in turn need to be propagated across the cluster, so I do not think frequently adding, changing or deleting aliases is a good idea if that is what you are considering. I do nowever not know a lot about the internals so will leave that for someone else.

---

<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 15, 2022, 7:33am UTC](https://discuss.elastic.co/t/about-the-implements-of-alias-addalias-and-removealias/305013/6 "2022-06-15T07:33:00Z")

</div>

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