Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix es get NotFoundError (#3659)

Zhichang Yu7669fc8f52c0
diff --git a/rag/utils/es_conn.py b/rag/utils/es_conn.py
index 0630f84136..a5b266b8f2 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: