How to change the default amount of shards and replicas of indices?

ELK version: 5.5.1

I referred to this page https://www.elastic.co/guide/en/elasticsearch/reference/5.5/indices-update-settings.html and changed a index's number of replica, and it worked, but how to add it to the config file to make it valid for all new indices?

Referred to this page https://www.elastic.co/guide/en/elasticsearch/reference/5.5/index-modules.html#dynamic-index-settings , I add

index.number_of_shards: 7
index.number_of_replicas: 2

to elasticsearch.yml, but it didn't work...ES can't startup...

1 Like

Use index templates instead.

Hello, is there a guide about how to set this using template...?

A simple search for "index templates" on elastic.co website:

Will lead you to: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/indices-templates.html

1 Like

Thanks, and how to use template to modify this value? :flushed:

Should be something like:

PUT _template/all
{
  "template": "*",
  "settings": {
    "number_of_shards": 7,
    "number_of_replicas": 2
  }
}
11 Likes

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