[英]Elasticsearch Python indexing operation to remote host doesn't work (connection refused) but cURL works fine
I have a remote host that I'd like to write to with elasticsearch's python client.我有一个远程主机,我想用 elasticsearch 的 python 客户端写入。 I have the elasticsearch service up and running on my remote host, and I have a connection/client set up:
我在远程主机上启动并运行了 elasticsearch 服务,并且设置了连接/客户端:
conn = elasticsearch.Urllib3HttpConnection(host='https://my_host.net', port=9200, ssl_version='SSLv2')
es = Elasticsearch(connection=conn)
also, curl my_host.net:9200
works just fine.此外,
curl my_host.net:9200
工作得很好。 But running es.index(whatever)
doesn't work.但是运行
es.index(whatever)
不起作用。 Any ideas why?任何想法为什么?
Set the Elasticsearch host and port:设置 Elasticsearch 主机和端口:
es_host = 'https://my_host.net:9200'
Connect to the Elasticsearch host:连接到 Elasticsearch 主机:
es = Elasticsearch(hosts=[es_host])
Hope this works in your case.希望这适用于您的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.