From 7669fc8f52c0cabb03d8feca45108b506497dc4d Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Tue, 26 Nov 2024 18:07:07 +0800 Subject: [PATCH] Fix es get NotFoundError (#3659) ### What problem does this PR solve? Fix es get NotFoundError ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- rag/utils/es_conn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rag/utils/es_conn.py b/rag/utils/es_conn.py index 0630f8413..a5b266b8f 100644 --- a/rag/utils/es_conn.py +++ b/rag/utils/es_conn.py @@ -215,11 +215,11 @@ class ESConnection(DocStoreConnection): id=chunkId, source=True, ) if str(res.get("timed_out", "")).lower() == "true": raise Exception("Es Timeout.") - if not res.get("found"): - return None chunk = res["_source"] chunk["id"] = chunkId return chunk + except NotFoundError: + return None except Exception as e: logging.exception(f"ESConnection.get({chunkId}) got exception") if str(e).find("Timeout") > 0: