https://www.elastic.co/guide/cn/elasticsearch/guide/current/partial-updates.html
elasticsearch _update更新部分字段内容
update 请求最简单的一种形式是接收文档的一部分作为 doc 的参数, 它只是与现有的文档进行合并。对象被合并到一起,覆盖现有的字段,增加新的字段。
POST /website/blog/1/
{
"title": "My first blog entry",
"text": "Just trying this out..."
}
例如,我们增加字段 tags 和 views 到我们的博客文章,如下所示:
POST /website/blog/1/_update
{
"doc" : {
"tags" : [ "testing" ],
"views": 0
}
}
删除字段
POST /index/type/1/_update
{
"script" : "ctx._source.remove(\"name\")"
}
批量删除
POST /index/type/_update_by_query
{
"script" : "ctx._source.remove(\"name\")",
"query": {
"bool": {
"must": [
{
"exists": {
"field": "name"
}
}
]
}
}
}
删除mapping 里面的字段,目前还不支持,只能建立新的mapping了