class Elasticsearch::Transport::Transport::HTTP::Faraday

The default transport implementation, using the [Faraday](rubygems.org/gems/faraday) library for abstracting the HTTP client.

@see Transport::Base

Public Instance Methods

__build_connection(host, options={}, block=nil) click to toggle source

Builds and returns a connection

@return [Connections::Connection]

# File lib/elasticsearch/transport/transport/http/faraday.rb, line 37
def __build_connection(host, options={}, block=nil)
  client = ::Faraday::Connection.new(__full_url(host), options, &block)
  Connections::Connection.new :host => host, :connection => client
end
host_unreachable_exceptions() click to toggle source

Returns an array of implementation specific connection errors.

@return [Array]

# File lib/elasticsearch/transport/transport/http/faraday.rb, line 46
def host_unreachable_exceptions
  [::Faraday::Error::ConnectionFailed, ::Faraday::Error::TimeoutError]
end
perform_request(method, path, params={}, body=nil) click to toggle source

Performs the request by invoking {Transport::Base#perform_request} with a block.

@return [Response] @see Transport::Base#perform_request

# File lib/elasticsearch/transport/transport/http/faraday.rb, line 19
def perform_request(method, path, params={}, body=nil)
  super do |connection, url|
    headers = connection.connection.headers

    response = connection.connection.run_request \
      method.downcase.to_sym,
      url,
      ( body ? __convert_to_json(body) : nil ),
      headers

    Response.new response.status, response.body, response.headers
  end
end