es 更新指定字段的方法

第一种:统一es 唯一id 就行修改单条数据

在这里插入图片描述

post ip + 端口、index/_id/_udpate

{
	
    "doc" : {
        "content" : "深圳有限公司 法人代表 断网,在《律兜互联》订单,成功支付 1000 元。"
        
    }
}

在这里插入图片描述
index/type/id
usercenter-prod/behavior-collector/hjsuPXoBI6JTTbY_gkKa/_update

{
    "doc": {
        "created": "1624060800000"
    }
}

第二种:
先查询

{
    "query": {
        "bool": {
            "filter": [
                {
                    "bool": {
                        "must": [
                            {
                                "match_phrase": {
                                    "id": {
                                        "query": "792705003818463232"
                                    }
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "script": {
        "inline": "ctx._source.oneLevelId=1;ctx._source.twoLevelId=7"
    }
}

版权声明:本文为m0_37383866原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。