我有一个 nodejs 应用程序,它调用 ES 的 updateByQuery API,如下所示:
elasticsearchClient.updateByQuery({
index: 'logstash-dev-2019.05.14',
body: {
"query": {
"ids": {
"values": alert.esId
}
},
"script": {
"source": `ctx._source.alertObject.violation_status = 'closed'`,
"lang": "painless"
}
}
});
但是偶尔,我会遇到version_conflict_engine_exception
. 我想通过使用文档中conflict=proceed
提到的来处理冲突。我在哪里适合我的更新电话?
您可以使用文档中querystring
提供的对象,请滚动到链接的末尾。
elasticsearchClient.updateByQuery({
index: 'logstash-dev-2019.05.14',
querystring: {
"conflict": "proceed"
},
body: {
"query": {
"ids": {
"values": alert.esId
}
},
"script": {
"source": `ctx._source.alertObject.violation_status = 'closed'`,
"lang": "painless"
}
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句