# Elasticsearch index tempalte aliases

**URL:** <https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071>\
**Category:** Elasticsearch\
**Created:** [December 3, 2018, 1:33am UTC](https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071 "2018-12-03T01:33:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![test987654123](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@test987654123](https://discuss.elastic.co/u/test987654123)\
**Post date:** [December 3, 2018, 1:33am UTC](https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071/1 "2018-12-03T01:33:01Z")

</div>

Hi, Every body, I want to implement an automatic alias based on the field when the index is created.

This is a index template setting configuartion;  
{  
"order": 5,  
"version": 60001,  
"index\_patterns": [  
"debug\*"  
],  
"settings": {  
"index": {  
"number\_of\_shards": "1",  
"number\_of\_replicas": "0",  
"refresh\_interval": "1s"  
}  
},  
"mappings": {  
"doc": {  
"properties": {  
"logLevel": {  
"type": "keyword"  
},  
"hostname": {  
"type": "keyword"  
},  
"application": {  
"type": "keyword"  
}  
}  
}  
},  
"aliases": {  
"{application}-alias-for-{env}": {  
"format": {  
"env": {  
"lang": "expression",  
"script": "doc['logLevel'].value"  
},  
"application": {  
"lang": "expression",  
"script": "doc['application'].value"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![mjunaidmuzammil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mjunaidmuzammil/32/56910_2.png) [@mjunaidmuzammil](https://discuss.elastic.co/u/mjunaidmuzammil)\
**Post date:** [December 3, 2018, 4:45am UTC](https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071/2 "2018-12-03T04:45:57Z")

</div>

I dont think so this is supported. Templates are applied over index at the time of index creation, not at the time of document indexing. I have seen any method of defining custom placeholders. As per the documentation only index placeholder is supported.

[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)

---

<div class="post-metadata">

**Author:** ![test987654123](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@test987654123](https://discuss.elastic.co/u/test987654123)\
**Post date:** [December 5, 2018, 4:03am UTC](https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071/3 "2018-12-05T04:03:22Z")

</div>

Yes, I know. Just see someone using it.

> <https://github.com/elastic/elasticsearch/issues/5359>

---

<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:** [January 2, 2019, 4:03am UTC](https://discuss.elastic.co/t/elasticsearch-index-tempalte-aliases/159071/4 "2019-01-02T04:03:26Z")

</div>

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