Elasticsearch server connection

Asked

Viewed 58 times

0

Good afternoon!

I’m trying to connect in Elasticsearch, but I’m not getting, I don’t know if I need to inform anything else in class es=Elasticsearch(..)

# Import Elasticsearch package 
from elasticsearch import Elasticsearch 

es=Elasticsearch([{'host':'https://elk-site.....com.br','port':9200}])

print(es.info())

Exception occurred: Connectionerror Connectionerror(<urllib3.connection.Httpconnection Object at 0x04EEC6B8>: Failed to Establish a new Connection: [Errno 11001] getaddrinfo failed) caused by: Newconnectionerror(<urllib3.connection.Httpconnection Object at 0x04EEC6B8>: Failed to Establish a new Connection: [Errno 11001] getaddrinfo failed) File "C: Ecommerce Projects website Infrastructure ELK Servico Save.py", line 9, in print (es.info())

When accessing the url it brings the normal data.

inserir a descrição da imagem aqui

  • Are you using a redirector (NGINX type)? Based on what you posted, the Python script vc is using the TCP port 9200 and accessing the standard port by the browser, ie TCP 80. Change the script to es=Elasticsearch([{'host':'https://elk-site.....com.br','port':80}])

  • @Paulomarques misses that very thing vlw

1 answer

0

I solved the problem by pointing to port 80 and changing use_ssl to False.

es = Elasticsearch([{'host': 'elk-site....com.br', 'port': 80, 'use_ssl': False}])

Browser other questions tagged

You are not signed in. Login or sign up in order to post.