elasticsearch 失败时使用update_by_查询接收管道会导致版本冲突\u引擎\u异常
情况: 我将“”语句设置为现有管道,如下所示(对于整个管道): 问题: 管道与update_by_查询API一起使用,以丰富文档。如果出现故障,管道不会将故障文档转发到故障索引,即failed-my_索引。这是由于以下错误消息导致的结果:
elasticsearch 失败时使用update_by_查询接收管道会导致版本冲突\u引擎\u异常,
elasticsearch,
elasticsearch,情况: 我将“”语句设置为现有管道,如下所示(对于整个管道): 问题: 管道与update_by_查询API一起使用,以丰富文档。如果出现故障,管道不会将故障文档转发到故障索引,即failed-my_索引。这是由于以下错误消息导致的结果: { "took": 276, "timed_out": false, "total": 1, "updated": 0, "deleted"
{
"took": 276,
"timed_out": false,
"total": 1,
"updated": 0,
"deleted": 0,
"batches": 1,
"version_conflicts": 1,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0,
"failures": [
{
"index": "failed-my_index",
"type": "_doc",
"id": "1002109",
"cause": {
"type": "version_conflict_engine_exception",
"reason": "[1002109]: version conflict, required seqNo [37265539], primary term [20]. but no document was found",
"index_uuid": "JMepgCegQamU8WDqQuFJ3Q",
"shard": "0",
"index": "failed-my_index"
},
"status": 409
}
]
}
这是正确的,因为文档“1002109”不存在于失败的索引中,因为它在最初索引时没有失败更新时,管道失败,文档需要进入失败的索引。由于上面的版本冲突错误,这不会发生。
我做错了什么
如关于\u update\u by\u查询
端点中所述,欢迎提供任何帮助:
此API仅允许您修改匹配文档的源,而不能移动它们。
脚本文档中也提供了有关在中可以执行的操作的信息,因为我们可以看到大多数ctx.\u*
字段都是只读的:
- ctx[“U路由”](字符串,只读):用于选择用于文档存储的碎片的值
- ctx[''u index'](字符串,只读):索引的名称
- ctx[''u type'](字符串,只读):索引中的文档类型
- ctx[''u id'](int,只读):唯一的文档id
- ctx[“U版本](int,只读):当前版本的 文件
因此,使用“按查询更新”无法更改文档的索引。但是,您可以标记文档,然后使用reindex+delete by query组合将这些标记的文档移动到失败的索引中。谢谢您的回答。如果这是真的,那么它一定是一个bug,因为摄取管道的正常规范允许它在运行时处理管道故障……这不是bug,这是一个特性,我已经更新了我的答案
{
"took": 276,
"timed_out": false,
"total": 1,
"updated": 0,
"deleted": 0,
"batches": 1,
"version_conflicts": 1,
"noops": 0,
"retries": {
"bulk": 0,
"search": 0
},
"throttled_millis": 0,
"requests_per_second": -1,
"throttled_until_millis": 0,
"failures": [
{
"index": "failed-my_index",
"type": "_doc",
"id": "1002109",
"cause": {
"type": "version_conflict_engine_exception",
"reason": "[1002109]: version conflict, required seqNo [37265539], primary term [20]. but no document was found",
"index_uuid": "JMepgCegQamU8WDqQuFJ3Q",
"shard": "0",
"index": "failed-my_index"
},
"status": 409
}
]
}