ES-更新语句
1、根据id更新POST idx_product-fat/doc/100101/_update{"doc" : {"minPrice" : 3,"price" : 2}}idx_product-fat 索引名称doctype类型10006145 iddoc 文档(固定)minPrice字段名称2、条件更新POST idx_hippo
·
1、根据id更新
POST idx_product-fat/doc/100101/_update
{
"doc" : {
"minPrice" : 3,
"price" : 2
}
}
idx_product-fat 索引名称
doc type类型
10006145 id
doc 文档(固定)
minPrice字段名称
2、条件更新
POST idx_hippo_sku_statistics_index/_update_by_query
{
"script": {
"source": "ctx._source['distributionChannel']=1"
},
"query": {
"term":{
"cityId":138
}
}
}
idx_hippo_sku_statistics_index 索引
_update_by_query 特定条件更新语法
"query": {
"term":{
"cityId":138
}
}
更新的时候必须要满足的条件
"script": {
"source": "ctx._source['distributionChannel']=1"
}
语法相对固定:
distributionChannel 要被更新的字段, 后面是对应的更新字段的值;
3、覆盖更新
PUT /idx_product-fat/doc/10006145
{
"minPrice": 1,
"price": 30
}
idx_product-fat 索引名称
doc type类型
10006145 id
覆盖更新,就是原来会有很多个字段,使用了这个sql之后就会把原来的值全部更新
更多推荐


所有评论(0)