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


(Keith Tt) #1

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...


(David Pilato) #2

Use index templates instead.


(Keith Tt) #3

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


(David Pilato) #4

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


(Keith Tt) #5

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


(David Pilato) #6

Should be something like:

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

(system) #7

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