Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] Throw DocumentNotFoundError if index doesnt exist when looking for doc by id #2916

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions connectors/es/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,18 @@ async def fetch_by_id(self, doc_id):
return self._create_object(resp_body)

async def fetch_response_by_id(self, doc_id):
if not self.serverless:
await self._retrier.execute_with_retry(
partial(self.client.indices.refresh, index=self.index_name)
)

try:
if not self.serverless:
await self._retrier.execute_with_retry(
partial(self.client.indices.refresh, index=self.index_name)
)

resp = await self._retrier.execute_with_retry(
partial(self.client.get, index=self.index_name, id=doc_id)
)
except ApiError as e:
logger.critical(f"The server returned {e.status_code}")
logger.critical(e.body, exc_info=True)
logger.error(f"The server returned {e.status_code}")
logger.error(e.body, exc_info=True)
if e.status_code == 404:
msg = f"Couldn't find document in {self.index_name} by id {doc_id}"
raise DocumentNotFoundError(msg) from e
Expand Down
Loading