# Elasticsearch.js function for performing atomic alias remove and add?

**URL:** <https://discuss.elastic.co/t/elasticsearch-js-function-for-performing-atomic-alias-remove-and-add/16853>\
**Category:** Elasticsearch\
**Created:** [April 7, 2014, 5:31pm UTC](https://discuss.elastic.co/t/elasticsearch-js-function-for-performing-atomic-alias-remove-and-add/16853 "2014-04-07T17:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brent\_D](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@Brent\_D](https://discuss.elastic.co/u/Brent_D)\
**Post date:** [April 7, 2014, 5:31pm UTC](https://discuss.elastic.co/t/elasticsearch-js-function-for-performing-atomic-alias-remove-and-add/16853/1 "2014-04-07T17:31:30Z")

</div>

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.htmldocuments](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.htmldocuments) a technique to atomically rename an alias within a single API  
call using a _remove_ and _add_ operation.

Is there a way to accomplish this same thing using a single  
elasticsearch.js API function call? I know I could do an  
_indices.deleteAlias_ followed by an _indices.putAlias_, but that wouldn't  
be atomic. It's not clear to me exactly what _indices.updateAliases_ does,  
but doesn't appear to be an atomic remove/add.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/baf08f9f-f128-43f0-9532-ddae5b23aa80%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/baf08f9f-f128-43f0-9532-ddae5b23aa80%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Spencer\_Alger](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Spencer\_Alger](https://discuss.elastic.co/u/Spencer_Alger)\
**Post date:** [April 8, 2014, 4:31pm UTC](https://discuss.elastic.co/t/elasticsearch-js-function-for-performing-atomic-alias-remove-and-add/16853/2 "2014-04-08T16:31:30Z")

</div>

You are correct, the indices.updateAliases() method expects an array of  
actions for it's body (as described on the page you linked).

Spencer

On Monday, April 7, 2014 10:31:30 AM UTC-7, Brent D wrote:

> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/indices-aliases.htmldocuments) a technique to atomically rename an alias within a single API  
> call using a _remove_ and _add_ operation.
> 
> Is there a way to accomplish this same thing using a single  
> elasticsearch.js API function call? I know I could do an  
> _indices.deleteAlias_ followed by an _indices.putAlias_, but that  
> wouldn't be atomic. It's not clear to me exactly what  
> _indices.updateAliases_ does, but doesn't appear to be an atomic  
> remove/add.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/34d267b3-aaf9-4288-9ca2-15d35a0949e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/34d267b3-aaf9-4288-9ca2-15d35a0949e2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:37am UTC](https://discuss.elastic.co/t/elasticsearch-js-function-for-performing-atomic-alias-remove-and-add/16853/3 "2017-07-06T01:37:31Z")

</div>


