# Super confused about multiple indices with a single alias

**URL:** https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176
**Category:** Elasticsearch
**Created:** [February 18, 2016, 6:22pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176 "2016-02-18T18:22:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![patrick99e99](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick99e99/32/609_2.png) [@patrick99e99](https://discuss.elastic.co/u/patrick99e99)
#### Post date: [February 18, 2016, 6:22pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176/1 "2016-02-18T18:22:52Z")

</div>

I have read the documentation that says:

> An alias can point to multiple indices, so we need to remove the alias from the old index at the same time as we add it to the new index. The change needs to be atomic, which means that we must use the \_aliases endpoint:

say I have an index "stuff\_v1", with an alias "stuff".

And also say that stuff\_v1 has an incorrect type for a column in the mapping and I need to fix that.

I was under the impression that I could:

1. update my mapping with the correct type.
2. create a new index "stuff\_v2" with the new mapping
3. set the alias "stuff" on it so both "stuff\_v1" and "stuff\_v2" have the same alias
4. scan & scroll stuff\_v1 into stuff\_v2 -- meanwhile because they both share the same alias, indexing a record will work and go into both indices.

... That's what I thought was how all this works...

However, when I tried to do this, I get:

ElasticsearchIllegalArgumentException[Alias [stuff\_alias] has more than one indices associated with it [[stuff\_v1, stuff\_v2]], can't execute a single index op]

so................................... I guess I totally don't understand how this zero downtime stuff is really supposed to work.

???

---

<div class="post-metadata">

### Author: ![Camilo\_Sierra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/camilo_sierra/32/14397_2.png) [@Camilo\_Sierra](https://discuss.elastic.co/u/Camilo_Sierra)
#### Post date: [February 18, 2016, 6:24pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176/2 "2016-02-18T18:24:29Z")

</div>

the alias you can used to read, when you index use the real index name!

you search with "stuff" and index in "stuff\_v2"

---

<div class="post-metadata">

### Author: ![patrick99e99](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick99e99/32/609_2.png) [@patrick99e99](https://discuss.elastic.co/u/patrick99e99)
#### Post date: [February 18, 2016, 6:40pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176/3 "2016-02-18T18:40:11Z")

</div>

But the whole point is, during a scan & scroll on a huge document that takes hours, I want both stuff\_v1 and stuff\_v2 to be indexed at the same time so that when I am done with the scan & scroll, I don't have any missing records. The goal is to be able to remove the alias on stuff\_v1.

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [February 18, 2016, 8:31pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176/4 "2016-02-18T20:31:48Z")

</div>

Except when you are querying both you may get duplicate records, how will you deal with that?

---

<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 5, 2017, 11:15pm UTC](https://discuss.elastic.co/t/super-confused-about-multiple-indices-with-a-single-alias/42176/5 "2017-07-05T23:15:07Z")

</div>


