One alias with multiple indices

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c6436e1d-a6d1-46c9-8303-e10bb883a8ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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] 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8b736701-4ce6-49aa-b44d-1cd88418dcdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d46c709c-6940-4db9-9948-d2fb93dc50d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.