title: The difference between XPOST and XPUT
body: <p>I am learning <code>Elasticsearch</code>, I found that <code>XPOST</code> and <code>XPUT</code> are in general the same when 'update' or 'replace' documents. They all change the field values.</p>
  
  <pre><code>curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '
  {
    "name": "Jane Doe"
  }'
  
  curl -XPOST 'localhost:9200/customer/external/1/_update?pretty' -d '
  {
    "doc": { "name": "Jane Doe" }
  }'
  </code></pre>
  
  <p>So they all changed the name field to "Jane Doe". I am wondering whats the difference between <code>XPOST</code> and <code>XPUT</code> in the above context.</p>