elasticsearch,Ruby,elasticsearch" /> elasticsearch,Ruby,elasticsearch" />

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

使用ruby gem,如何连接到indexdepot elasticsearch实例?,ruby,elasticsearch,Ruby,elasticsearch,indexdepot上my RelaticsSearch索引的uri为: 'http://xxx:xxx@www.indexdepot.com/elasticsearch/954dc1d4a0fddcf6/' 端口号是80 因此,我尝试了以下方法: require "elasticsearch" require "elasticsearch/transport" require "json" Elasticsearch::Client.new host: 'http://xxx:xx

indexdepot上my RelaticsSearch索引的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)

这是怎么回事?似乎它正在尝试建立本地连接。目前,我正在尝试从本地机器而不是远程网站进行连接,这是否相关?感谢所有的帮助。多谢各位

它应该不是
host
,而是
url
,并且:80端口必须紧跟在域名后面谢谢,首先它不起作用。我会做实验的。很好,谢谢。