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

[FIX] elasticsearch vector_store: add await for self.client.indices.exist #11438

Merged
merged 1 commit into from
Feb 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ async def _create_index_if_not_exists(
index_name: Name of the AsyncElasticsearch index to create.
dims_length: Length of the embedding vectors.
"""
if self.client.indices.exists(index=index_name):
if await self.client.indices.exists(index=index_name):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@logan-markewich IIRC I think there was some reason as to why we removed the await? Or maybe I'm wrong and it never was there to begin with.

I do think we need to have this since the client is and async client though.

Copy link
Contributor Author

@nerdai nerdai Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for visibility on this issue:

  • it appears a lower version of elasticsearch python client actually does not yield a Coroutine when clinet.indices.exists was invoked (see this older issue) -- there elasticsearch v8.8.0 was used.
  • this is no longer the case for the most recent version of elasticsearch (at time of this comment, v8.12.1).
  • since v8.12.1 is the minimum requirement for this integration (i.e. see pyproject.toml), we should be safe to add back await now.

logger.debug(f"Index {index_name} already exists. Skipping creation.")

else:
Expand Down
Loading