Elasticsearch

Hi,

Anyone knows how to change the default number_of_shards and number_of_replicas settings suring service start? I mean in elasticsearch.yml file instead doing it per index.


"settings": {
"index": {
"creation_date": "1542404566909",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "X3TNFX29QIqGrTytvkSqTA",
"version": {
"created": "6040399"


Thanks,

Shashi

  • post-author-pic
    Myles Y
    11-20-2018

    You can set the default number of replica and primary shards for an index pattern using an index template. This is covered in the following lesson: https://linuxacademy.com/cp/courses/lesson/course/3059/lesson/4/module/257


    To set this globally, you will still use a template, but you will use an index pattern of "*" in order to match every index. You typically want to call an index like this "all" or something similar to denote that it affects every index.

    Depending on if you want to match multiple index templates, you will want to think about the order in which they are applied. You can use the "order" parameter in the template definition to define in which order or precedence templates have when applied.

Looking For Team Training?

Learn More