# Add a method to compute alias names for index templates

**URL:** <https://discuss.elastic.co/t/add-a-method-to-compute-alias-names-for-index-templates/157199>\
**Category:** Elasticsearch\
**Created:** [November 18, 2018, 1:52am UTC](https://discuss.elastic.co/t/add-a-method-to-compute-alias-names-for-index-templates/157199 "2018-11-18T01:52:44Z")\
**Posts on this page:** 2\
**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:** [November 18, 2018, 1:52am UTC](https://discuss.elastic.co/t/add-a-method-to-compute-alias-names-for-index-templates/157199/1 "2018-11-18T01:52:44Z")

</div>

I want to implement automatic mapping of aliases when created by index。 Use the following link。

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

  

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

This is my profile.  
{  
"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"  
}  
}  
}  
}  
}

But, result is

GET /\_aliases  
"debug-2018": {  
"aliases": {  
"application": {},  
"{application}-alias-{env}": {}  
}  
},

---

<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:** [December 16, 2018, 1:52am UTC](https://discuss.elastic.co/t/add-a-method-to-compute-alias-names-for-index-templates/157199/2 "2018-12-16T01:52:49Z")

</div>

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