本文档为您介绍使用阿里云Elasticsearch(简称ES)服务更新文档的方法。

通过Kibana控制台访问阿里云ES,执行以下命令更新文档。
  • 更新整个文档:
    PUT /my_index/my_type/1?pretty
    {
      "title": "One World One Dream", 
      "tags": ["ruby"],
      "post_date":"2009-11-15T13:00:00"
    }
    更新成功后,返回结果如下:
    {
      "_index" : "my_index",
      "_type" : "my_type",
      "_id" : "1",
      "_version" : 2,
      "result" : "updated",
      "_shards" : {
        "total" : 2,
        "successful" : 2,
        "failed" : 0
      },
      "_seq_no" : 1,
      "_primary_term" : 1
    }
  • 更新部分文档:
    POST /my_index/my_type/1/_update?pretty
    {
      "doc":{"title": "One World"}
    }
    更新成功后,返回结果如下:
    {
      "_index" : "my_index",
      "_type" : "my_type",
      "_id" : "1",
      "_version" : 3,
      "result" : "updated",
      "_shards" : {
        "total" : 2,
        "successful" : 2,
        "failed" : 0
      },
      "_seq_no" : 2,
      "_primary_term" : 1
    }