mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-02 04:46:31 +00:00
Test ES connection only for the default user (#1028)
This commit is contained in:
parent
c41101ff74
commit
9bec8859f2
@ -180,11 +180,17 @@ class ElasticsearchDocumentStore(BaseDocumentStore):
|
||||
scheme=scheme, ca_certs=ca_certs, verify_certs=verify_certs,
|
||||
timeout=timeout)
|
||||
|
||||
# Test connection
|
||||
# Test connection
|
||||
try:
|
||||
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).")
|
||||
# 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 "
|
||||
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