Elasticsearch-ruby, hard time to connect to cluster (5.3.0)

(Tom) #1

Just started using elasticsearch-ruby. I am trying to get my feet wet with a basic test, but I don't make any progress. That's what I have:

Elastic 5.3.0 in a Docker, working nicely with Kibana and curl on the console.

When I start the rails console I do the following:

require 'elasticsearch' => false
client = Elasticsearch::Client.new log: true => => #<Elasticsearch::Transport::Client:0x00558b5c6d58c0 arguments={:log=>true, :logger=>#<Logger:0x00558b5c6d5780 @level=0, progname="elasticsearch", default_formatter=#<Logger::Formatter:0x00558b5c6d5730 datetime_format=nil>, formatter=#Proc:0x00558b5c6d54d8@/usr/local/bundle/gems/elasticsearch-transport-5.0.4/lib/elasticsearch/transport/client.rb:15, logdev=#<Logger::LogDevice:0x00558b5c6d5690 shift_period_suffix=nil, @shift_size=nil, shift_age=nil, filename=nil........(had to remov e all @)
client.cluster.health => 2017-05-04 13:41:19 +0000: [ArgumentError] wrong number of arguments (given 1, expected 0) ({:host=>"localhost", :port=>9200, :protocol=>"http"})
ArgumentError: wrong number of arguments (given 1, expected 0)

Whatever I do (client.search, client.health, client.index) I always get a "[ArgumentError] wrong number of arguments (given 1, expected 0)", so I assume something basic is wrong. Any idea what this could be?

Thanks, Tom

(Tom) #2

Replying to myself here, may this help somebody:

I was able to fix this problem by removing "net-http-persistent" from my Gemfile and remove the adapter: :net_http_persistent from client = Elasticsearch::Client.new.

This is not ideal as this kills permanent connections, but good enough for development.

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.