Problem with configuring index template via file

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b78efdfb-3449-432f-a23a-fdff3e3a0e1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f0c7553c-fa83-43d4-962a-c3876e0fbc87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0a39e19f-875a-4e08-b7e4-49ecb722a079%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ba98f7f5-5a25-4b1e-9da0-c564aaf8dc93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9010cf90-fe16-49a0-98a1-d4662246bcf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/74574095-e63c-4110-8d4f-c2283e1c7dcc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.