Changing index template, advice on layout

I'm upgrading ES 2.3 -> 5.x, and using the upgrade migration helper. It essentially tells me to move two settings out of elasticsearch.yml into index templates:

  • index.merge.scheduler.max_thread_count
  • index.number_of_shards

Here's how I've started: Get the existing template, 'de-nest' it by one level:

$ curl 'localhost:9200/_template/logstash?pretty' > logstash.template.json
$ sed -i '' -e '$d' -e '2d' logstash.template.json

Here's where I'm stuck. I want to add in the configuration values from above, but I'm not sure where in that file to put them. Do I follow the dot pattern with curly brackets? e.g. Is it it in settings -> merge -> scheduler -> max_thread_count ?

If I don't get any advice I guess I'll hack around with some testing.

Later on, I plan to overwrite the existing template. I've tried this with a test template and it seems to work.

$ curl -XPUT 'http://localhost:9200/_template/logstash?pretty' -d @logstash.template.json

TIA,
Greg.

No answer, so I hacked about. It seemed to work to follow the dot pattern with curly bracket nesting:

$ head -11 logstash.template.json 
{
    "order" : 0,
    "template" : "logstash-*",
    "settings" : {
      "index" : {
        "merge" : {
          "scheduler" : {
            "max_thread_count" : "1"
          }
        },
        "number_of_shards" : "2",

I've removed the entries from elasticsearch.yml, restarted ES, and new indices get the right number of shards, and hopefully that means I've got the max_thread_count right.

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