# Multiple indices, one alias..single document\_id possible?

**URL:** <https://discuss.elastic.co/t/multiple-indices-one-alias-single-document-id-possible/87274>\
**Category:** Elasticsearch\
**Created:** [May 26, 2017, 3:24pm UTC](https://discuss.elastic.co/t/multiple-indices-one-alias-single-document-id-possible/87274 "2017-05-26T15:24:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Justin\_Cross](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/justin_cross/32/104500_2.png) [@Justin\_Cross](https://discuss.elastic.co/u/Justin_Cross)\
**Post date:** [May 26, 2017, 3:24pm UTC](https://discuss.elastic.co/t/multiple-indices-one-alias-single-document-id-possible/87274/1 "2017-05-26T15:24:49Z")

</div>

Hi, when we have a single index elasticsearch updates the existing document if a new db row comes in from logstash jdbc for a document\_id that already exists in elasticsearch, otherwise inserts. That is great but now we want that between multiple indices. We started creating a new index each day for purging reasons like this:

search-05-25-2017  
search-05-26-2017

We want to know if it's possible to use the same alias for each index and have the alias be used when storing new documents into the indices. Our situation is that we want to update the existing document when a new oracle row comes in that matches the document\_id of an existing index instead of making new document in the next days index.

For example , if search-05-25-2017 contains document\_id 1, and it is now the 26th, we want to add to elasticsearch through the alias and it automatically update the document if it exists in any of the indices of that alias, otherwise insert into todays index. So if another row with id 1 comes in, we want it to update search-05-25-2017 instead of adding to today's index.

Is that possible?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 26, 2017, 3:36pm UTC](https://discuss.elastic.co/t/multiple-indices-one-alias-single-document-id-possible/87274/2 "2017-05-26T15:36:23Z")

</div>

No, that is not possible. You can only index or update through an alias if it is only linked to a single underlying index. If you have a field in the database that dictates which index the record went to, e.g. creation date, you could build logic around this. Otherwise I can not think of any other way than search to find the record before updating or look it up somewhere else, e.g. in a separate index that this type of data.

---

<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:** [June 23, 2017, 3:36pm UTC](https://discuss.elastic.co/t/multiple-indices-one-alias-single-document-id-possible/87274/3 "2017-06-23T15:36:25Z")

</div>

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