elasticsearch '无法建立连接,因为目标机器在使用密码验证后主动拒绝了它'

2izufjch  于 2022-11-22  发布在  ElasticSearch
关注(0)|答案(1)|浏览(167)

我正在尝试使用python elasticsearch库连接到我的elasticsearch示例:

es = Elasticsearch(HOST="https://elastic:password@3392047428db45a0b0e41659542.us-central1.gcp.cloud.es.io",PORT=9243)
es = Elasticsearch()

但我总是收到错误消息:

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)

我也尝试了,但得到相同的错误:

es = Elasticsearch(['3392047428db45a0b0e41659542.us-central1.gcp.cloud.es.io'], http_auth=('elastic', 'password'))

如果我获得URL并手动输入usernamepassword,我就可以连接。请帮助我了解此错误的可能原因......提前感谢:)

bqujaahr

bqujaahr1#

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')

相关问题