Hello,
Since corona-wise, we got to stay at home nowadays, I was thinking it's a good time to learn a bit about the Elastic Python client library. First of all, apologies for the noobish question..
I seem to have difficulties connecting to an Elasticsearch node. My goal is very simple (for now) => To cat all indices on a cluster.
First I tried:
from elasticsearch import Elasticsearch
if __name__ == '__main__':
es = Elasticsearch(
['<myesnode>'],
http_auth=('elastic', '<pass>'),
scheme="https",
port=9200,
)
print(es2.cat.indices("index_name", h=("h","s","i","id","p","r","dc","dd","ss","creation.date.string"), s="creation.date"))
But I get a connection error:
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x04DFD3B8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed
Then I tried without kwargs:
es2=Elasticsearch(['https://elastic:<pass>@<myesnode>:9200/'])
print(es2.cat.indices("index_name", h=("h","s","i","id","p","r","dc","dd","ss","creation.date.string"), s="creation.date"))
And then I get:
elasticsearch.exceptions.SSLError: ConnectionError([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)) caused by: SSLError([SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108))
The ssl certificate for our clusters are created with a private pki. The CA is in the Windows certificate store, so should be recognised?
I have exported our CA chain pem to a location on my C drive, but how can I make the es connection work and use a supplied ca pem?
Thanks!
WIllem