# Aliases using Index Templates and best practice for managing templates/policies

**URL:** <https://discuss.elastic.co/t/aliases-using-index-templates-and-best-practice-for-managing-templates-policies/193417>\
**Category:** Elasticsearch\
**Created:** [August 1, 2019, 10:36pm UTC](https://discuss.elastic.co/t/aliases-using-index-templates-and-best-practice-for-managing-templates-policies/193417 "2019-08-01T22:36:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikasp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikasp/32/90872_2.png) [@vikasp](https://discuss.elastic.co/u/vikasp)\
**Post date:** [August 1, 2019, 10:36pm UTC](https://discuss.elastic.co/t/aliases-using-index-templates-and-best-practice-for-managing-templates-policies/193417/1 "2019-08-01T22:36:53Z")

</div>

I am using logstash to push the data to elasticsearch and my ouptut plugin is like this:

elasticsearch  
{  
hosts =\> ["x.x.x.x:9200","x.x.x.x:9200","x.x.x.x:9200"]  
index =\> "union\_thread-%{+YYYY.MM}"  
user =\> "xxxxxxx"  
password =\> "xxxxxxx"  
ssl =\> true  
cacert =\> "/etc/logstash/CA.pem"  
template\_name =\> "template\_1"  
}

Its working without the template\_name. I just figured out on templates, to use them to configure the number of shards while creating the index itself and also can add lifecycle policies.  
Aside all that, I see in the documentation for creating templates  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html)  
the below content:  
PUT \_template/template\_1  
{  
"index\_patterns" : ["te\*"],  
"settings" : {  
"number\_of\_shards" : 1  
},  
"aliases" : {  
"alias1" : {},  
"alias2" : {  
"filter" : {  
"term" : {"user" : "kimchy" }  
},  
"routing" : "kimchy"  
},  
"{index}-alias" : {}  
}  
}

I am not sure I understand the aliases section.  
In the line, "alias1" : {}.  
I know alias1 is the alias that's getting created/ adding the index to the alias1 once the index is created.  
Can somebody help me understand what's {} for. Or any documentation

I went throught the Index aliases documentation, but couldn't get to correlate anything I found there.

Also, what is the best practice of managing templates/ rolling over Indices:

Right now, what I am doing is  
I have my template and lifecycle policies created in Dev Tools, add the policy name in template.  
Give the template name in logstash.

So, I have multiple beat inputs like 10 and will keep increasing. How do I manage templates and policies. what is the best practice or best way to do/automate 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:** [August 29, 2019, 10:37pm UTC](https://discuss.elastic.co/t/aliases-using-index-templates-and-best-practice-for-managing-templates-policies/193417/2 "2019-08-29T22:37:11Z")

</div>

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