我正在使用elasticsearch js client,我想找到wirh attrs.tags==的所有字段并删除该值。更新返回200和1个正确的已更新事件。但当我列出所有事件时,仍然可以看到attrs.tags的旧值。为什么不起作用?即使我等待5分钟给弹性时间来更新它,我仍然得到相同的结果。
async function search() {
var tag = req.body.tags;
var client = connectToES(res);
const response = await client.updateByQuery({
index: "*",
type: '_doc',
body: {
"query": {
"match": {
"attrs.tags": tag
}
},
"script": { "inline": "ctx._source.attrs.tag = ''" }
}
});
client.close();
}
这里是弹性React: {"took":34,"timed_out":false,"total":1,"updated":1,"deleted":0,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1,"throttled_until_millis":0,"failures":[]}
暂无答案!
目前还没有任何答案,快来回答吧!