【发布时间】:2015-10-21 08:53:09
【问题描述】:
我在我的一个项目中使用弹性搜索。我在更新记录时遇到问题。我收到的错误消息是:-
{ _index: 'makes',
_type: 'make',
_id: '55b8cdbae36236490d00002a',
status: 409,
error: 'VersionConflictEngineException[[makes][0] [make][55b8cdbae36236490d00002a]: version conflict, current [168], provided [167]]' }
使用 ES 批量 api。我的应用程序在 node.js 中。
让我也分享一下我的代码:-
var conditions = [];
conditions.push({
update: {
_index: config.elasticSearch.index,
_type: config.elasticSearch.type,
_id: id
}
});
conditions.push({
doc: {
published: true
}
});
client.bulk({
body: conditions
}, function(err, resp) {
console.log(resp);
console.log(resp.items[0].update);
return res.send({success: true, message: "Shows updated successful"})
});
下面是条件数组的值:
[ { update:
{ _index: 'makes',
_type: 'make',
_id: '55b8cdbae36236490d00002a' } },
{ doc: { published: true } } ]
【问题讨论】:
标签: node.js elasticsearch-plugin elasticsearch