# Is it possible to have an alias that points two multiple indexes with duplicate IDs with preference ordering?

**URL:** <https://discuss.elastic.co/t/is-it-possible-to-have-an-alias-that-points-two-multiple-indexes-with-duplicate-ids-with-preference-ordering/244480>\
**Category:** Elasticsearch\
**Created:** [August 11, 2020, 2:26am UTC](https://discuss.elastic.co/t/is-it-possible-to-have-an-alias-that-points-two-multiple-indexes-with-duplicate-ids-with-preference-ordering/244480 "2020-08-11T02:26:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacobm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacobm/32/47016_2.png) [@jacobm](https://discuss.elastic.co/u/jacobm)\
**Post date:** [August 11, 2020, 2:26am UTC](https://discuss.elastic.co/t/is-it-possible-to-have-an-alias-that-points-two-multiple-indexes-with-duplicate-ids-with-preference-ordering/244480/1 "2020-08-11T02:26:12Z")

</div>

My situation is: I have a big index (let's call it `old`) that allows search on documents that I derive from information in a relational database. I need to change the index mapping and add data to every document, and the easiest way I see to do that is to re-derive every document from the database and insert it into a new index (let's call it `new`) that is configured with the updated mappings.

Unfortunately, this process is going to take some time, and it would be great if, in the middle of the migration, my application had access to the new versions of already-migrated documents and could fall back to the old versions of documents that haven't been migrated yet.

My first attempt at achieving this was to set up an alias, `merged`, where both `old` and `new` pointed to `merged` with `new` being the write index. Unfortunately, once the process got going, `new` contained documents that had the same ID as documents in `old`, and that caused Elasticsearch to throw an error.

Is there any way to set things up so that instead of throwing an error, I could configure Elasticsearch to prefer documents from `new` and fall back on `old` only if nothing is found for `new`? Given that I found nothing about it in the reference, I am guessing the answer here is "no" -- if that's the case, then is there another approach I could take to this migration that would work better?

Thanks! Any insights would be appreciated.

---

<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:** [August 11, 2020, 7:06am UTC](https://discuss.elastic.co/t/is-it-possible-to-have-an-alias-that-points-two-multiple-indexes-with-duplicate-ids-with-preference-ordering/244480/2 "2020-08-11T07:06:52Z")

</div>

There's no way to do that natively.  
You'd need your code to read the new index, then if nothing was found, fall back to the old one.

---

<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:** [September 8, 2020, 7:06am UTC](https://discuss.elastic.co/t/is-it-possible-to-have-an-alias-that-points-two-multiple-indexes-with-duplicate-ids-with-preference-ordering/244480/3 "2020-09-08T07:06:54Z")

</div>

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