5. 更新文档:

(1). 整个文档相同的key覆盖:

curl -XPUT "localhost:9200/lib/user/1?pretty" -H 'Content-Type: application/json' -d'{
    "name": "David",
    "age": 30,
    "interests": ["music", "driver"]
}'
{
  "_index" : "lib",
  "_type" : "user",
  "_id" : "1",
  "_version" : 2,
  "result" : "updated",
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 1,
  "_primary_term" : 1
}

(2). 修改文档相应的字段:

curl -XPOST "localhost:9200/lib/user/1/_update?pretty" -H 'Content-Type: application/json' -d'{
 "doc":{
    "age": 100
  }
}'
结果:
{
  "_index" : "lib",
  "_type" : "user",
  "_id" : "1",
  "_version" : 3,
  "result" : "updated",
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 2,
  "_primary_term" : 1
}