浏览代码

Fix: tag_feas deletion error. (#6257)

### What problem does this PR solve?

#6218

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.18.0
Kevin Hu 7 个月前
父节点
当前提交
dd81c30976
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8
    1
      rag/utils/es_conn.py

+ 8
- 1
rag/utils/es_conn.py 查看文件

# update specific single document # update specific single document
chunkId = condition["id"] chunkId = condition["id"]
for i in range(ATTEMPT_TIME): for i in range(ATTEMPT_TIME):
for k in doc.keys():
if "feas" != k.split("_")[-1]:
continue
try:
self.es.update(index=indexName, id=chunkId, script=f"ctx._source.remove(\"{k}\");")
except Exception:
logger.exception(f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
try: try:
self.es.update(index=indexName, id=chunkId, doc=doc) self.es.update(index=indexName, id=chunkId, doc=doc)
return True return True
except Exception as e: except Exception as e:
logger.exception( logger.exception(
f"ESConnection.update(index={indexName}, id={id}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
if re.search(r"(timeout|connection)", str(e).lower()): if re.search(r"(timeout|connection)", str(e).lower()):
continue continue
break break

正在加载...
取消
保存