سؤال

Is it possible to set the timeout property of a Faraday transport when creating a Ruby Elasticsearch::Client? There is the scope to pass a block when initializing an Elasticsearch::Transport::Transport::Faraday instance, but when trying the below we only ever get an empty set of connections back from __build_connections:

transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new do |connection|
  # connection.timeout = 1 # ???
end

Any suggestions as to how we should implement this block to set the timeout?

هل كانت مفيدة؟

المحلول

you can run this.

Elasticsearch::Client.new transport_options: {
  request: { timeout: 1 }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top