使用ruby gem,我如何连接到indexdepot elasticsearch实例?

时间:2015-06-16 08:26:09

标签: ruby elasticsearch

我对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)

这里发生了什么?似乎它试图建立本地连接。目前,我正在尝试从本地计算机而不是远程网站进行连接,这是相关的吗?感谢所有的帮助。谢谢。

0 个答案:

没有答案