title: How to update the Elasticsearch document with Python?
body: <p>I am using the code below to add data to Elasticsearch:</p>
  <pre class="lang-py prettyprint-override"><code>from elasticsearch import Elasticsearch
  es = Elasticsearch()
  es.cluster.health()
  records = [
      {'Name': 'Dr. Christopher DeSimone', 'Specialised and Location': 'Health'},
      {'Name': 'Dr. Tajwar Aamir (Aamir)', 'Specialised and Location': 'Health'},
      {'Name': 'Dr. Bernard M. Aaron', 'Specialised and Location': 'Health'}
  ]
  es.indices.create(index='my-index_1', ignore=400)
      
  for record in records:
      # es.indices.update(index=&quot;my-index_1&quot;, body=record)
      es.index(index=&quot;my-index_1&quot;, body=record)
      
      # Retrieve the data
      es.search(index='my-index_1')['hits']['hits']
  </code></pre>
  <p>But how do I update the document?</p>
  <pre class="lang-py prettyprint-override"><code>records = [
      {'Name': 'Dr. Messi', 'Specialised and Location': 'Health'},
      {'Name': 'Dr. Christiano', 'Specialised and Location': 'Health'},
      {'Name': 'Dr. Bernard M. Aaron', 'Specialised and Location': 'Health'}
  ]
  </code></pre>
  <p>Here <code>Dr. Messi, Dr. Christiano</code> has to update the index and <code>Dr. Bernard M. Aaron</code> should not update as it is already present in the index.</p>