# One alias with multiple indices

**URL:** <https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230>\
**Category:** Elasticsearch\
**Created:** [February 18, 2015, 9:43am UTC](https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230 "2015-02-18T09:43:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tao\_hiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tao_hiko/32/707_2.png) [@tao\_hiko](https://discuss.elastic.co/u/tao_hiko)\
**Post date:** [February 18, 2015, 9:43am UTC](https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230/1 "2015-02-18T09:43:53Z")

</div>

Hello,

I created a alias that contain multiple indices and I can get data without  
any error but insert/update data via alias that show below message

{  
"error": "ElasticsearchIllegalArgumentException[Alias [data-active] has  
more than one indices associated with it [[data-v4, data-v2, data-v3]],  
can't execute a single index op]",  
"status": 400  
}

Actually, inserting and updating are working on data-v4 only but I need to  
do via alias because I can reuse application code without any change.

Is it possible to configure something to do like that?

Thank you,  
Hiko

--  
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/c6436e1d-a6d1-46c9-8303-e10bb883a8ba%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/c6436e1d-a6d1-46c9-8303-e10bb883a8ba%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [February 18, 2015, 12:17pm UTC](https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230/2 "2015-02-18T12:17:49Z")

</div>

Hi,

You can't use aliases which point to multiple indexes for indexing  
operations. This is because there is no way of elasticsearch knowing which  
index in your alias you want to apply the indexing operation to.

What you can do instead is to create another alias called something like  
'data-write' and point it at the index you want to use to write data to.  
This way your application can always point to the alias (data-write) to  
write data and the alias (data-active) to read data. Then you can change  
the index in 'data-write' when the index you are wanting to write to  
changes (making sure you do the add an remove in a single request, example  
in [1]) and you can change the indexes in 'data-active' when the indexes  
you want to read/search from change.

Hope this makes sense

Colin

[1] [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html)

On Wednesday, 18 February 2015 09:43:53 UTC, tao hiko wrote:

> Hello,
> 
> I created a alias that contain multiple indices and I can get data without  
> any error but insert/update data via alias that show below message
> 
> {  
> "error": "ElasticsearchIllegalArgumentException[Alias [data-active] has  
> more than one indices associated with it [[data-v4, data-v2, data-v3]],  
> can't execute a single index op]",  
> "status": 400  
> }
> 
> Actually, inserting and updating are working on data-v4 only but I need to  
> do via alias because I can reuse application code without any change.
> 
> Is it possible to configure something to do like that?
> 
> Thank you,  
> Hiko

--  
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/8b736701-4ce6-49aa-b44d-1cd88418dcdd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8b736701-4ce6-49aa-b44d-1cd88418dcdd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![tao\_hiko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tao_hiko/32/707_2.png) [@tao\_hiko](https://discuss.elastic.co/u/tao_hiko)\
**Post date:** [February 19, 2015, 3:56am UTC](https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230/3 "2015-02-19T03:56:36Z")

</div>

Hi Colin,

Thank you for your advice that is a good solution.

Thank you,  
Hiko

--  
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/d46c709c-6940-4db9-9948-d2fb93dc50d6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d46c709c-6940-4db9-9948-d2fb93dc50d6%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, 12:31am UTC](https://discuss.elastic.co/t/one-alias-with-multiple-indices/22230/4 "2017-07-06T00:31:42Z")

</div>


