curl -XPOST "http://172.17.0.1:9200/ecm__versioneditem/_update_by_query" -H 'Content-Type: application/json' -d'
{
"query":{"term":{"s_cachedpdf_status_s": {"value":"done"}}},
"script":{
"source":"ctx._source.remove('\''s_cachedpdf_status_s'\'');",
"lang": "painless"
}
}'
如果你的需求是将`s_cachedpdf_status_s`字段的值更新为1,而不是删除这个字段,你可以使用Elasticsearch的更新API来实现。下面是正确的代码示例:
curl -XPOST "http://172.17.0.1:9200/ecm__versioneditem/_update_by_query" \
-H 'Content-Type: application/json' \
-d '{
"query": {
"term": {
"s_cachedpdf_status_s": {
"value": "done"
}
}
},
"script": {
"source": "ctx._source.s_cachedpdf_status_s = 1;",
"lang": "painless"
}
}'
这段代码中,`-XPOST` 表示发送一个POST请求,`-H` 指定了请求头,`-d` 指定了请求体。在请求体中,`query` 部分定义了查