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)
This commit is contained in:
Zhichang Yu 2024-11-26 18:07:07 +08:00 committed by GitHub
parent 98cf1c2a9d
commit 7669fc8f52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: