Cannot connect to elastic cluster on VPN machine

Hi, I am new to Elasticsearch. What I managed to do so far is to bring up ElasticSearch container and successfully connect to it using both http connection(via Postman) and using python client.

However, now I want to bring up such a container not on my machine. And I managed to bring this machine up and connect using http call. But when I try to connect through python client I get this error:

elastic_transport.TlsError: TLS error caused by: TlsError(TLS error caused by: SSLError(hostname '34.116.***.***' doesn't match either of 'localhost', '172.19.0.2', '127.0.0.1', 'bde723133f75'))

How I connect:

   es = Elasticsearch(
        https://34.116.***.***:9200",
        ca_certs=cert.crt,
        basic_auth=(elastic_user, elastic_password),
    )

Error occurres on this line res = es.search(index="pdf-documents", query=query)

Welcome to our community! :smiley:

What are your Elasticsearch and docker config?

I am using docker-compose:

  elastic:
    container_name: elastic
    image:
      docker.elastic.co/elasticsearch/elasticsearch:8.3.2
    ports:
      - "9200:9200"
      - "9300:9300"

And I did not configure anything more in Elastichsearch just copied cert and resetted password

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