Update only specific field value in elasticsearch

后端 未结 6 948
轻奢々
轻奢々 2020-12-28 12:22

Is it possible to update some specific fields value in elasticsearch with out overwriting other fields. ?

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 12:47

    As a codebased contribution to this answer, the following query may be used:

    POST /index/type/100100471/_update
    {
        "doc" : {
            "yourProperty" : 10000
        }
    }
    

    This query updates yourProperty property only.

    As a result, this response appears:

    {
       "_index": "index",
       "_type": "type",
       "_id": "100100471",
       "_version": 1,
       "_shards": {
          "total": 0,
          "successful": 1,
          "failed": 0
       }
    }
    

提交回复
热议问题