# How to create an alias for each new index

**URL:** <https://discuss.elastic.co/t/how-to-create-an-alias-for-each-new-index/178113>\
**Category:** Elasticsearch\
**Created:** [April 23, 2019, 8:43pm UTC](https://discuss.elastic.co/t/how-to-create-an-alias-for-each-new-index/178113 "2019-04-23T20:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Willian\_Cardoso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willian_cardoso/32/44661_2.png) [@Willian\_Cardoso](https://discuss.elastic.co/u/Willian_Cardoso)\
**Post date:** [April 23, 2019, 8:43pm UTC](https://discuss.elastic.co/t/how-to-create-an-alias-for-each-new-index/178113/1 "2019-04-23T20:43:22Z")

</div>

Hi guys,

Is this possible?

> curl -X PUT "localhost:9200/_template/template\_1" -H 'Content-Type: application/json' -d'  
> {  
> "index\_patterns" : ["\*"],  
> "aliases" : {  
> "{index}_{date}" : {}  
> }  
> }'

I need all time to create a new indice, too create a respective alias, but with the current date.  
Ex.:

> curl -X PUT "localhost:9200/twitter" # creating a new index  
> curl -X GET "localhost:9200/twitter/\_alias/" # show the alias  
> {  
> "twitter" : {  
> "aliases" : {  
> "twitter\_2019-04-23" : { },  
> }  
> }  
> }

---

<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:** [May 21, 2019, 8:43pm UTC](https://discuss.elastic.co/t/how-to-create-an-alias-for-each-new-index/178113/2 "2019-05-21T20:43:23Z")

</div>

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