I am trying to connect to my elasticsearch instance using the python elasticsearch library:
es = Elasticsearch(HOST="https://elastic:password@3392047428db45a0b0e41659542.us-central1.gcp.cloud.es.io",PORT=9243)
es = Elasticsearch()
but I keep getting the error :
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x000002BD624E6208>: Failed to establish a new connection:
[WinError 10061] No connection could be made because the target machine actively refused it) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x000002BD624E6208>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it)
I also tried but am getting the same error:
es = Elasticsearch(['3392047428db45a0b0e41659542.us-central1.gcp.cloud.es.io'], http_auth=('elastic', 'password'))
if I GET the URL and enter the username
and password
manually, I'm able to connect.
Please help me understand what might be a possible reason for this error...Thanks in advance :)
from elasticsearch import Elasticsearch
es = Elasticsearch(['https://test-ced76a.es.us-centrdadsal1.gcp.cloud.es.io'],http_auth=('elastic', 'password'),scheme="https",port=9243)
es.indices.create(index='my-index')