20
Verify connection to Elasticsearch by sethmlarson · Pull Request #1623 · elastic...
source link: https://github.com/elastic/elasticsearch-py/pull/1623
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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 with401
or403
pass the check and show a warning (message will be linked later). This happens if themonitor
permission missing for user. The subsequent checks must be ignored. - If there's no
version
field or if theversion
field value is <6.0.0 raise an error. - If there is a
version
field and it's >= 6.0.0 and <7.0.0:- If there is no
tagline
field or if thetagline
field value isn'tYou know, for Search
raise an error.
- If there is no
- If there is a
version
field and it's >=7.0.0 and <7.14.0:- If there is no
tagline
field or if thetagline
field value isn'tYou know, for Search
raise an error. - If there is no
build_flavor
field or if thebuild_flavor
field value isn'tdefault
raise an error.
- If there is no
- If there is a
version
field and it's >=7.14.0:- If there is no
X-Elastic-Product
HTTP header in the response or if theX-Elastic-Product
HTTP header value isn'tElasticsearch
raise an error.
- If there is no
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK