ES update_by_query 更新冲突解决方法
问题描述:ES在多次更细同一条数据时会产生冲突elasticsearch.exceptions.ConflictError: ConflictError(409, '{"took":4,"timed_out":false,"total":1,"updated":0,"deleted":0,"batches":1,"version_conflicts":1,"noops":0,"retries":{
问题描述:
ES在多次更细同一条数据时会产生冲突
elasticsearch.exceptions.ConflictError: ConflictError(409, '{"took":4,"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.0,"throttled_until_millis":0,"failures":[{"index":"xxxx","type":"xxxx","id":"901d7ee97489c9ebb5a0498ce9fe8a3a","cause":{"type":"version_conflict_engine_exception","reason":"[xxxx][901d7ee97489c9ebb5a0498ce9fe8a3a]: version conflict, current version [31] is different than the one provided [30]","index_uuid":"FAR-xl5RS3ywZTw3kazGZA","shard":"0","index":"source_code_leak"},"status":409}]}')
解决方法:
增加{"refresh": "true"} es.update_by_query(index="xxx", body=query, doc_type="", params={"refresh": "true"})
更多推荐
所有评论(0)