update_by_query API
_update_by_query API 用法
官方接口文档https://www.elastic.co/guide/en/elasticsearch/reference/8.6/docs-update-by-query.html
- 用法
post {index}/_update_by_query?conflicts=proceed
参数:conflicts=proceed 当更新doc有版本号冲突时 ,不中断,继续执行更新后续数据。
如:
post product_index/_update_by_query?conflicts=proceed
{
"script":{
"inline":"ctx._source.rank++",
"lang":"painless"
},
"query": {
"bool": {
"filter": [
{
"term": {
"uid": {
"value": "1605136305101209601"
}
}
}
,{
"range": {
"product.hot_index": {
"gte": -100,
"lte": 700
}
}
}
]
}
}
}