Updating the default index number_of_replicas setting for new indices

后端 未结 1 599
情书的邮戳
情书的邮戳 2020-12-31 09:02

I\'ve tried updating the number of replicas as follows, according to the documentation

curl -XPUT \'localhost:9200/_settings\' -d \'
{ \"index\" : { \"number         


        
相关标签:
1条回答
  • 2020-12-31 09:47

    Yes, you can use index templates. Index templates are a great way to set default settings (including mappings) for new indices created in a cluster.

    Index Templates

    Index templates allow to define templates that will automatically be applied to new indices created. The templates include both settings and mappings, and a simple pattern template that controls if the template will be applied to the index created.

    http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html

    For your example:

    curl -XPUT 'localhost:9200/_template/logstash_template' -d ' 
    { 
      "template" : "logstash-*", 
      "settings" : {"number_of_replicas" : 4 }
    } '
    

    This will set the default number of replicas to 4 for all new indexes that match the name "logstash-*". Note that this will not change existing indexes, only newly created ones.

    0 讨论(0)
提交回复
热议问题