Elasticsearch 更新某个字段


_update 直接通过ID更新

POST /index_name/type/id/_update
{
  "doc": {
    "column": "column_value"
  }
}

_update_by_query 按查询条件更新

//旧版本(5.5.1以下)source 字段改为 inline
POST index_name/_update_by_query

{
  "query": {
    "terms": {
      "tags.keyword": [
        "线程"
      ]
    }
  },
  "script": {
    "inline": "ctx._source['tags'] = params['one']",
    "params": {
      "one": "thread"
    }
  }
}


原文链接:https://codingdict.com/