Elasticsearch _bulk更新问题给出VersionConflictEngineException消息
我在我的一个项目中使用elasticsearch。 我在更新logging时遇到问题。 我得到的错误信息是: –
{ _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 } } ]
当你开始查询一个logging时,它的logging包括该logging的版本的响应。 当你想更新它,但在它之前,它已经被另一个更新,数据库中的logging比客户想象的更高版本。 这可能会发生,因为有些操作仍然在队列中,所以你得到未处理的logging(因此更低的版本)。 发生这种情况时,请尝试https://www.elastic.co/guide/en/elasticsearch/reference/1.6/indices-refresh.html :
curl -XPOST 'http://localhost:9200/{your_index}/_refresh'
然后再次调用你的方法
- 如何运行elasticsearch-hq?
- 用javascript api使用弹性search插入到数组中
- 将Nodejs应用程序容器安全地连接到弹性search容器(Docker)
- 在nodejs中使用elasticsearch获取基于属性值的文档
- 如何通过弹性search在expressjs中解决Not Found消息
- RangeError:在node_modules – > elasticsearch中超出最大调用堆栈大小
- illegal_argument_exception:没有为字段find映射
- 无法使用Firebase和ElasticSearch(使用手电筒)进行正确的path监控或查询
- ElasticSearch创build索引types错误