gem 'typhoeus'
undefined method `connect_timeout=' for #Typhoeus::Request:0x007fc43c4e8128
config = {
host: Settings.elasticsearch_servers,
transport_options: {
request: { timeout: 5 }
},
}
Elasticsearch::Model.client = Elasticsearch::Client.new(config)
I've found lostisland/faraday#366 and https://github.com/lostisland/faraday#331, would you be able to debug it a little bit on new typhoeus and faraday versions?
This is the code I'm able to replicate the error with:
require 'typhoeus'
require 'elasticsearch'
config = { host: 'localhost:9200', transport_options: { request: { timeout: 5 } } }
client = Elasticsearch::Client.new(config);
# => #<Elasticsearch::Transport::Client:0x007ff6c09e34a0
client.info
# NoMethodError: undefined method `connect_timeout=' for #<Typhoeus::Request:0x007fcc656a6a88>
Same problem here. Any ideas why?
Any luck with this? I think the issue might be https://github.com/lostisland/faraday/issues/608 where typhoeus ships with an updated adapter for faraday and the default adapter bundled with faraday is stale.
FYI: for now i just put
require 'typhoeus'
require 'typhoeus/adapters/faraday'
in a rails initializer to override the default class.
I've tested the aboved-mentioned code and have encountered no error.
```ruby
2.5.1 :014 > require 'typhoeus'
=> true
2.5.1 :014 > require 'elasticsearch'
=> false
2.5.1 :015 >
2.5.1 :016 > config = { host: 'localhost:9200', transport_options: { request: { timeout: 5 } } }
=> {:host=>"localhost:9200", :transport_options=>{:request=>{:timeout=>5}}}
2.5.1 :017 >
2.5.1 :018 > client = Elasticsearch::Client.new(config);
=> #
2.5.1 :019 > client.info
=> {"name"=>"kjYMuDR", "cluster_name"=>"elasticsearch", "cluster_uuid"=>"4pWKrUkFQJGDrgCv_UUrRA", "version"=>{"number"=>"6.4.2", "build_flavor"=>"default", "build_type"=>"tar", "build_hash"=>"04711c2", "build_date"=>"2018-09-26T13:34:09.098244Z", "build_snapshot"=>false, "lucene_version"=>"7.4.0", "minimum_wire_compatibility_version"=>"5.6.0", "minimum_index_compatibility_version"=>"5.0.0"}, "tagline"=>"You Know, for Search"}
Most helpful comment
FYI: for now i just put
in a rails initializer to override the default class.