title: ES-6 .1. - How change default number of shards
body: <p>I am using ES 6.1. and I am trying to change default number of shards from 5 to, for example, 6. Is it possible in some way? When I add lines bellow to the <code>elasticsearch.yaml</code> file, the ES will not start.</p>
  
  <pre><code>index.number_of_replicas : 1
  index.number_of_shards: 6
  </code></pre>
  
  <p>The error looks like this:</p>
  
  <blockquote>
    <p>Found index level settings on node level configuration.</p>
    
    <p>Since elasticsearch 5.x index level settings can NOT be set on the
    nodes configuration like the elasticsearch.yaml, in system properties
    or command line arguments.In order to upgrade all indices the settings
    must be updated via the /${index}/_settings API. Unless all settings
    are dynamic all indices must be closed in order to apply the
    upgradeIndices created in the future should use index templates to set
    default values.</p>
    
    <p>Please ensure all required values are updated on all indices by
    executing:</p>
    
    <p>curl -XPUT
    '<a href="http://localhost:9200/_all/_settings?preserve_existing=true" rel="nofollow noreferrer">http://localhost:9200/_all/_settings?preserve_existing=true</a>' -d '{
    "index.number_of_replicas" : "1", "index.number_of_shards" : "6" }'</p>
  </blockquote>
  
  <p><strong>My understanding:</strong><br>
  If I have no indices or when all indices are closed, i can change default value via :</p>
  
  <pre><code>curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{
  "index.number_of_replicas" : "1",
  "index.number_of_shards" : "6"
  }'
  </code></pre>
  
  <p>Otherwise I am not possible to change default number of shards.</p>
  
  <p>I know I can't change number of shard after indices are created. I can create index like this</p>
  
  <pre><code>curl -XPUT  "$(hostname -I):9200/myindex/_settings?pretty" -H 'Content-Type: application/json' -d'
  {
      "index" : {
          "number_of_shards" : 2, 
          "number_of_replicas" : 0 
      }
  }
  '
  </code></pre>
  
  <p>I am sending data to ES from Logstash, and create indexes automatically with name depends on date and type, so I cannot create every index manually.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Is there any way how to change default number of shard? If yes, how?  </li>
  <li>May I have different indices with different number of shards?</li>
  </ol>