llama_index
llama_index copied to clipboard
[Bug]: About ServerDisconnectedError(Server disconnected) in ElasticsearchStore
Bug Description
When there are more than 10 queries running simultaneously, the AsyncElasticsearch client may raise a ServerDisconnectedError(Server disconnected)
exception, as shown below:
elastic_transport.ConnectionError: Connection error caused by: ConnectionError(Connection error caused by: ServerDisconnectedError(Server disconnected))
Version
llama-index=0.10.14 llama-index-vector-stores-elasticsearch=0.1.5
Steps to Reproduce
A potential issue with the aquery
method in the llama_index.vector_stores.elasticsearch.base
module could be the cause of this problem, as shown below:
async with self.client as client:
response = await client.search(
index=self.index_name,
**es_query,
size=query.similarity_top_k,
_source={"excludes": [self.vector_field]},
)
I tried running the code block independently with manual queries, but it still generated the same exception.
However, nothing happens when using the async client directly without async with
:
response = await self.client.search(
index=self.index_name,
**es_query,
size=query.similarity_top_k,
_source={"excludes": [self.vector_field]},
)
So, I guess that async with
is redundant?
Relevant Logs/Tracbacks
No response