0

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?

Rayne
  • 14,247
  • 16
  • 42
  • 59

1 Answers1

0

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)
Paulo
  • 8,690
  • 5
  • 20
  • 34
  • I've tried with the scheme set to `https`, then `es.info()`, but it still gave the `Connection timed out` error. – Rayne Jun 26 '23 at 02:14
  • Are you sure your cluster is up and running ? Have you taken a look into the logs of Elasticsearch ? – Paulo Jun 26 '23 at 07:03
  • Yes, it is up and running. I've been monitoring it on Kibana, and it has been indexing documents for days. There isn't anything on the elasticsearch logs about trying to connect to it remotely. – Rayne Jun 27 '23 at 00:52