You can check if a cluster in Elasticsearch is running with the integral requests library. Alternatively, you can use a method of Elasticsearch's library low-level client. Try this cURL rquest to check if a cluster in Elasticsearch is active.
Testing the Install Once you have Elasticsearch installed and running on your local machine, you can test to see that it's up and running with a tool like curl. By default, Elasticsearch will be running on port 9200. Typically the machine will have a name like localhost .
OPTION 1: Check Version using Curl from Command Line In this example, Elasticsearch is running locally on the default port so our HTTP request will be to http://localhost:9200 . If Elasticsearch was running on a different server your HTTP request would take the form http://YOURDOMAIN.com:9200 .
What you can do is call ping
after creating the Elasticsearch
instance, like this:
es = Elasticsearch(['http://localhost:9200/'], verify_certs=True)
if not es.ping():
raise ValueError("Connection failed")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With