title: ElasticSearch Python client how to define number of shards when creating index
body: <p>I only need to have 1 shard for my index, but having a glance on the <a href="https://elasticsearch-py.readthedocs.io/en/master/api.html" rel="nofollow noreferrer">documentation</a> and google search doesn't give any clue on how to do it via the python client without using raw json format.</p>
  
  <p>I would expect something like:</p>
  
  <pre><code>from elasticsearch import Elasticsearch
  es = Elasticsearch()
  
  es.indices.create(index='test-index', shards=1)
  </code></pre>
  
  <p>Any ideas would be appreciated.</p>