elastisearch-update-api更新部分字段内容

https://www.elastic.co/guide/cn/elasticsearch/guide/current/partial-updates.html
update 请求最简单的一种形式是接收文档的一部分作为 doc 的参数, 它只是与现有的文档进行合并。对象被合并到一起,覆盖现有的字段,增加新的字段。

1
2
3
4
5
POST /website/blog/1/
{
"title": "My first blog entry",
"text": "Just trying this out..."
}

例如,我们增加字段 tags 和 views 到我们的博客文章,如下所示:

1
2
3
4
5
6
7
POST /website/blog/1/_update
{
"doc" : {
"tags" : [ "testing" ],
"views": 0
}
}