# Problem with configuring index template via file

**URL:** <https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348>\
**Category:** Elasticsearch\
**Created:** [March 13, 2014, 11:32am UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348 "2014-03-13T11:32:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Zemlyanoy](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sergey\_Zemlyanoy](https://discuss.elastic.co/u/Sergey_Zemlyanoy)\
**Post date:** [March 13, 2014, 11:32am UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/1 "2014-03-13T11:32:57Z")

</div>

Dear all,

In order to overwrite some index settings I created a custom template:

{  
"logstash2" : {  
"order" : 1,  
"template" : "logstash-\*",  
"settings" :  
{ "index.number\_of\_replicas" : "0" }

}  
}

Template is placed in /etc/elasticsearch/config/templates/logstash2.json

[root@logstash elasticsearch]# ls -la /etc/elasticsearch/  
total 56  
drwxr-xr-x 3 root root 4096 Feb 26 13:26 .  
drwxr-xr-x. 99 root root 12288 Feb 22 03:37 ..  
drwxr-xr-x 3 root root 4096 Feb 26 11:27 config  
rw-rr- 1 root root 12686 Feb 26 11:52 elasticsearch.yml  
rw-rr- 1 root root 12662 Jan 20 14:24 elasticsearch.yml.rpmsave  
rw-rr- 1 root root 1512 Jan 15 18:05 logging.yml

Also I leaved in default state elasticsearch.yml file, so all path  
variables are commented.  
After service restart I don't see any new index template. What am I doing  
wrong? Is the template path wrong?

Thanks in advance

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b78efdfb-3449-432f-a23a-fdff3e3a0e1b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b78efdfb-3449-432f-a23a-fdff3e3a0e1b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 13, 2014, 7:55pm UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/2 "2014-03-13T19:55:13Z")

</div>

You won't see your template in the list API, but if you create a new index  
named logstash-, it should take effect properly unless it is  
overriden by another template with a higher order.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/f0c7553c-fa83-43d4-962a-c3876e0fbc87%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f0c7553c-fa83-43d4-962a-c3876e0fbc87%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sergey\_Zemlyanoy](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sergey\_Zemlyanoy](https://discuss.elastic.co/u/Sergey_Zemlyanoy)\
**Post date:** [March 14, 2014, 3:18pm UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/3 "2014-03-14T15:18:05Z")

</div>

So is it enough data in my custom template in order to expect that new  
index will absorb its settings? Should I point out template's name in a  
dedicated field?

On Thursday, March 13, 2014 9:55:13 PM UTC+2, Binh Ly wrote:

> You won't see your template in the list API, but if you create a new index  
> named logstash-, it should take effect properly unless it is  
> overriden by another template with a higher order.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0a39e19f-875a-4e08-b7e4-49ecb722a079%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0a39e19f-875a-4e08-b7e4-49ecb722a079%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sergey\_Zemlyanoy](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sergey\_Zemlyanoy](https://discuss.elastic.co/u/Sergey_Zemlyanoy)\
**Post date:** [March 14, 2014, 3:36pm UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/4 "2014-03-14T15:36:10Z")

</div>

And I just tried to follow your advice:  
placed custom template in /etc/logstash/conf.d/templates/logstash2.json

{  
"order" : 2,  
"template" : "logstash-\*",  
"settings" : {  
"index.number\_of\_replicas" : "4"  
},  
"mappings" : { }  
}

then created a new index  
curl -XPUT localhost:9200/logstash-111

and checked the result

# curl -XGET localhost:9200/logstash-111/\_settings?pretty

{  
"logstash-111" : {  
"settings" : {  
"index" : {  
"uuid" : "l7HDeFfDS1arZr74ouwtyQ",  
"analysis" : {  
"analyzer" : {  
"default" : {  
"type" : "standard",  
"stopwords" : "_none_"  
}  
}  
},  
"number\_of\_replicas" : "1",  
"number\_of\_shards" : "5",  
"refresh\_interval" : "5s",  
"version" : {  
"created" : "1000051"  
}  
}  
}  
}  
}

And it look like custom setting didn't override (default number of replicas  
is 1)

On Friday, March 14, 2014 5:18:05 PM UTC+2, Sergey Zemlyanoy wrote:

> So is it enough data in my custom template in order to expect that new  
> index will absorb its settings? Should I point out template's name in a  
> dedicated field?
> 
> On Thursday, March 13, 2014 9:55:13 PM UTC+2, Binh Ly wrote:
> 
> > You won't see your template in the list API, but if you create a new  
> > index named logstash-, it should take effect properly unless it  
> > is overriden by another template with a higher order.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ba98f7f5-5a25-4b1e-9da0-c564aaf8dc93%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ba98f7f5-5a25-4b1e-9da0-c564aaf8dc93%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 14, 2014, 6:41pm UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/5 "2014-03-14T18:41:26Z")

</div>

I can think of 2 reasons:

1. When you start elasticsearch, it is not pointing to the conf directory  
that your are using

or

1. There is another template that overrides yours

I'm thinking #1 is more likely. How are you running ES, i.e., how is it  
installed and ran?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9010cf90-fe16-49a0-98a1-d4662246bcf2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9010cf90-fe16-49a0-98a1-d4662246bcf2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Sergey\_Zemlyanoy](https://avatars.discourse-cdn.com/v4/letter/s/90db22/32.png) [@Sergey\_Zemlyanoy](https://discuss.elastic.co/u/Sergey_Zemlyanoy)\
**Post date:** [March 17, 2014, 8:57am UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/6 "2014-03-17T08:57:19Z")

</div>

Finally I managed to solve it! It was caused by wrong template path -  
/etc/elasticsearch/config/templates/sometemplate.json

It should be /etc/elasticsearch/templates/sometemplate.json

Thanks a lot!

On Friday, March 14, 2014 8:41:26 PM UTC+2, Binh Ly wrote:

> I can think of 2 reasons:
> 
> 1. When you start elasticsearch, it is not pointing to the conf directory  
> that your are using
> 
> or
> 
> 1. There is another template that overrides yours
> 
> I'm thinking #1 is more likely. How are you running ES, i.e., how is it  
> installed and ran?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/74574095-e63c-4110-8d4f-c2283e1c7dcc%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/74574095-e63c-4110-8d4f-c2283e1c7dcc%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:42am UTC](https://discuss.elastic.co/t/problem-with-configuring-index-template-via-file/16348/7 "2017-07-06T01:42:51Z")

</div>


