Fix es get NotFoundError (#3659)
Browse files### 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 +2 -2
rag/utils/es_conn.py
CHANGED
@@ -215,11 +215,11 @@ class ESConnection(DocStoreConnection):
|
|
215 |
id=chunkId, source=True, )
|
216 |
if str(res.get("timed_out", "")).lower() == "true":
|
217 |
raise Exception("Es Timeout.")
|
218 |
-
if not res.get("found"):
|
219 |
-
return None
|
220 |
chunk = res["_source"]
|
221 |
chunk["id"] = chunkId
|
222 |
return chunk
|
|
|
|
|
223 |
except Exception as e:
|
224 |
logging.exception(f"ESConnection.get({chunkId}) got exception")
|
225 |
if str(e).find("Timeout") > 0:
|
|
|
215 |
id=chunkId, source=True, )
|
216 |
if str(res.get("timed_out", "")).lower() == "true":
|
217 |
raise Exception("Es Timeout.")
|
|
|
|
|
218 |
chunk = res["_source"]
|
219 |
chunk["id"] = chunkId
|
220 |
return chunk
|
221 |
+
except NotFoundError:
|
222 |
+
return None
|
223 |
except Exception as e:
|
224 |
logging.exception(f"ESConnection.get({chunkId}) got exception")
|
225 |
if str(e).find("Timeout") > 0:
|