Verify connection to Elasticsearch by sethmlarson · Pull Request #1623 · elastic/elasticsearch-py
Follows this logic for verifying a connection to Elasticsearch:
Before the first API request:
Make an API request to /, inspect the response:
If call to / fails with 401 or 403 pass the check and ...
GitHub