I am trying to connect elastic search thru python, However I get below connection error message.
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x0000021B1AA72DD8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x0000021B1AA72DD8>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed)
My script is as follows.
from elasticsearch import Elasticsearch
es=Elasticsearch(host="http://host/",port= 9200)
print(es.info())
Hi I have suppressed the address (confidential) it's elastic search hosted on AWS.
Connectivity is fine while connecting thru postman, elastic .net libraries and required access is in place.
Should work while doing same thru python?
Am I missing any configuration here?
Do you mean that you are hosting it by yourself or running Elasticsearch as a service by AWS?
More than that my question is actually: do you run your elasticsearch cluster without any security? Looking at the code you paste, it sounds like this. Unless you are doing something like:
es = Elasticsearch(['https://user:secret@localhost:443'])
The fact that you have suppressed the address in your post is hiding maybe an important mistake. But I can't really tell here.
Just a guess then, may be try:
es = Elasticsearch(
['host'],
scheme="http",
port=9200,
)
Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, APM, Logs UI, Infra UI, SIEM, Maps UI and what is coming next ...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.