mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-02 12:53:52 +00:00
Test ES connection only for the default user (#1028)
This commit is contained in:
parent
c41101ff74
commit
9bec8859f2
@ -182,9 +182,15 @@ class ElasticsearchDocumentStore(BaseDocumentStore):
|
||||
|
||||
# Test connection
|
||||
try:
|
||||
# ping uses a HEAD request on the root URI. In some cases, the user might not have permissions for that,
|
||||
# resulting in a HTTP Forbidden 403 response.
|
||||
if username in ["", "elastic"]:
|
||||
status = client.ping()
|
||||
if not status:
|
||||
raise ConnectionError(f"Initial connection to Elasticsearch failed. Make sure you run an Elasticsearch instance at `{hosts}` and that it has finished the initial ramp up (can take > 30s).")
|
||||
raise ConnectionError(
|
||||
f"Initial connection to Elasticsearch failed. Make sure you run an Elasticsearch instance "
|
||||
f"at `{hosts}` and that it has finished the initial ramp up (can take > 30s)."
|
||||
)
|
||||
except Exception:
|
||||
raise ConnectionError(
|
||||
f"Initial connection to Elasticsearch failed. Make sure you run an Elasticsearch instance at `{hosts}` and that it has finished the initial ramp up (can take > 30s).")
|
||||
|
Loading…
x
Reference in New Issue
Block a user