我正在使用Python中的ElasticSearch(elasticsearch==7.0.2
)客户端
from elasticsearch import Elasticsearch
client = Elasticsearch({
"host": "https://my-first-deployment.es.southamerica-east1.gcp.elastic-cloud.com",
"port": 9200
})
字符串
我从ElasticSearch中的第一个部署中获取主机名,复制端点:
的数据
但好像不管用
socket.gaierror: [Errno -3] Temporary failure in name resolution
型
我错过了什么?
编辑:我不知道它应该是什么端口,也不知道在哪里检查它。我假设它是9200,因为它是本地运行时的默认端口。
1条答案
按热度按时间t30tvxxf1#
我很确定你的端口是不正确的,你可能应该从主机名中删除
https://
,把它放在一个数组中,并以某种方式表明它应该使用ssl。我认为以这种格式使用整个端点可能会更容易:字符串
或者,您可以复制集群ID并像这样使用它:
型
注意:我假设你的用户名是
elastic
。另外,你的部署版本是什么?如果是8.x,你可能应该切换到相应的python客户端版本。