Python: ES.cluster.health() returns a Failed to establish a new connection: [Errno 11001] getaddrinfo failed) everytime I run

So I have the following code:

self.es.cluster.health(wait_for_status='yellow', request_timeout=1)

It was running originally but for some reason it stoped and I can't work out why, but no matter if I restart the server I will always get the following error.

{ConnectionError}ConnectionError(<urllib3.connection.HTTPConnection object at 0x00000203122196A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x00000203122196A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed)

Here is what ES is saying:

[2019-12-13T00:46:21,572][INFO ][o.e.l.LicenseService ] [DESKTOP-1N1BV30] license [5b61fe00-df18-4550-835d-24705d536ea9] mode [basic] - valid
[2019-12-13T00:46:21,574][INFO ][o.e.x.s.s.SecurityStatusChangeListener] [DESKTOP-1N1BV30] Active license is now [BASIC]; Security is disabled
[2019-12-13T00:46:21,592][INFO ][o.e.g.GatewayService ] [DESKTOP-1N1BV30] recovered [2] indices into cluster_state
[2019-12-13T00:46:21,716][INFO ][o.e.h.AbstractHttpServerTransport] [DESKTOP-1N1BV30] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}
[2019-12-13T00:46:21,723][INFO ][o.e.n.Node ] [DESKTOP-1N1BV30] started
[2019-12-13T00:46:22,031][INFO ][o.e.c.r.a.AllocationService] [DESKTOP-1N1BV30] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[forex][0]]]).

Why is this?

Thank you,

Merry Christmas.

it looks as if Elasticsearch has started up just fine.

You python client's error message indicates that there is an issue with resolving the host that you used in order to connect to elasticsearch. Can you share your setup? Also, it looks as if you are running Elasticsearch on localhost only. So if the python client and Elasticsearch are not running on the same system, you need to

  1. Bind Elasticsearch to an external IP address
  2. Try to use the ip address of the elasticsearch node to see if the connection gets established and if that works figure out why there might be DNS issue.

Hope this helps!

--Alex

I manedge to fix it in the end. I was getting confused with the index naming. After I changed the names around it worked. Thanks for the help Alex :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.