【前言】:语句针对5.0版本的ES。
- _update_by_query
功能:批量更新满足条件的场景;
curl -X POST "http://10.2.122.170:9200/index/type/_update_by_query" -H 'Content-Type: application/json' -d '{
"query": {
"bool": {
"filter": {
"terms": {
"_id": ["AVV_u51pGC2iX1EFQSzf","AVV_u51pGC2iX1EFQezh"]
}
}
}
},
"script": {
"inline":"ctx._source.updateTime = 1467907200000;ctx._source.userId='2970699'"
}
}'
- _delete_by_query
功能:批量删除满足条件的场景;
curl -X POST "http://192.168.16.65:9211/blog/_delete_by_query" -H 'Content-Type: application/json' -d '{
"query":{
"match":{
"title":"小明今晚真的不加班"
}
}
}'