Connection timeout when connecting to Elasticsearch using eland

391 views Asked by At

I'm trying to connect to my 3-node Elasticsearch (version 8.3.3) cluster remotely, using the eland library. I'm trying out with just one of the nodes first. This node has the following configuration in elasticsearch.yml.

network.host: 1.2.3.4

xpack.security.enabled: true

xpack.security.http.ssl:
  enabled: false

xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: xxx
  truststore.path: xxx

http.host and transport.host are both commented out in the config file.

I have the following code in another server in Jupyter Notebook.

from elasticsearch import Elasticsearch
import eland as ed

es = Elasticsearch([{'host': "1.2.3.4", 'port': 9200, 'scheme': 'http'}], basic_auth=("xxx","yyy"), request_timeout=120)

index="abc"
fields=["@timestamp", "fieldA", "fieldB"]

df = ed.DataFrame(es, index, columns=fields)

I keep getting Connection timed out. Just running es.info() also gets a Connection timed out error.

What can I do?

1

There are 1 answers

3
Paulo On

Tldr

I believe it could be because of the scheme you are using.

Shouldn't you be using https ?

Solution

from elasticsearch import Elasticsearch
import eland as ed

es = Elasticsearch([{'host': "1.2.3.4", 'port': 9200, 'scheme': 'https'}], basic_auth=("xxx","yyy"), request_timeout=120)
                                                                 ^^^^^ here
index="abc"
fields=["@timestamp", "fieldA", "fieldB"]

df = ed.DataFrame(es, index, columns=fields)