Set Faraday Timeout in Ruby ElasticSearch Client

elasticsearch, faraday, ruby

Solution

you can run this.

Elasticsearch::Client.new transport_options: {
  request: { timeout: 1 }
}

Problem

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?

Original source