我对indexdepot的elatsticsearch索引的uri是:
'http://xxx:xxx@www.indexdepot.com/elasticsearch/954dc1d4a0fddcf6/'
端口是80.
所以我尝试了以下内容:
require "elasticsearch"
require "elasticsearch/transport"
require "json"
Elasticsearch::Client.new host: 'http://xxx:xxx@www.indexdepot.com/elasticsearch/954dc1d4a0fddcf6:80'
client = Elasticsearch::Client.new log: true
jsondata = {first:"mari", last:"saga", email:"mari@operamail.com", password:"sugar"}
client.index index: 'swiss_candidates', type: 'users', body: jsondata
,错误信息为:
[Faraday::ConnectionFailed] Connection refused - connect(2) for "localhost" port 9200 {:host=>"localhost", :port=>"9200", :protocol=>"http"}
/usr/lib/ruby/2.1.0/net/http.rb:879:in `initialize': Connection refused - connect(2) for "localhost" port 9200 (Faraday::ConnectionFailed)
这里发生了什么?似乎它试图建立本地连接。目前,我正在尝试从本地计算机而不是远程网站进行连接,这是相关的吗?感谢所有的帮助。谢谢。