# Index Alias and Index operation

**URL:** <https://discuss.elastic.co/t/index-alias-and-index-operation/44369>\
**Category:** Elasticsearch\
**Created:** [March 14, 2016, 8:45pm UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369 "2016-03-14T20:45:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [March 14, 2016, 8:45pm UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/1 "2016-03-14T20:45:39Z")

</div>

I have to create an index alias representing two indexes, but index the content to one of the indexes based on a value. The case is as below:

Let us assume I have indexes 20160314\_16 and 20160317\_20 representing a weeks data. I need to have an alias which says WeekOf20160314, which represents both the index.

Now when I put a indexing request using alias, based on the attribute contentdate, the data should be indexed into appropriate index. Is it possible?

---

<div class="post-metadata">

**Author:** ![vikas\_gopal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikas_gopal/32/47661_2.png) [@vikas\_gopal](https://discuss.elastic.co/u/vikas_gopal)\
**Post date:** [March 14, 2016, 9:08pm UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/2 "2016-03-14T21:08:44Z")

</div>

Not sure what the requirement is but , in my scenario I am creating an index on daily basis based on content date and creating dashboard on all the indexes based on a common alias . I guess this is exactly you are looking for , if this is the case then it is possible .

---

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [March 14, 2016, 10:57pm UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/3 "2016-03-14T22:57:15Z")

</div>

We are not creating daily indexes as it will be 380+ at any given time in my cluster. We need to keep 15 months of data (hot and queriable). Thought of creating weekly indexes and split the index (by reindex as operation activity) when the size of shard goes above 50 GB....

---

<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:** [March 15, 2016, 12:40am UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/4 "2016-03-15T00:40:12Z")

</div>

You _can_ index through an alias, but only if there are no conflicts.  
If you index to an alias like this then the event will go to both/all indices.

---

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [March 15, 2016, 2:06am UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/5 "2016-03-15T02:06:29Z")

</div>

Thanks mark. We thought of controlling using metadata, but wanted to validate if we have some template based capability. It might be a good idea to add this capability to add this feature in ES upcoming versions...viz. Define which index the new content should go to based on a condition...

---

<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:** [March 15, 2016, 2:19am UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/6 "2016-03-15T02:19:26Z")

</div>

We recommend writing to a specific index instead of an alias to prevent this.

---

<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:08pm UTC](https://discuss.elastic.co/t/index-alias-and-index-operation/44369/7 "2017-07-05T23:08:32Z")

</div>


