def connection
      @connection ||= Faraday.new(url) do |conn|
        conn.response(:parse_json)
        # Request compressed responses from ES and decompress them
        conn.use(:gzip)
        conn.request(:encode_json)
        conn.request(:opaque_id) if @opaque_id
        conn.request(:limit_size, max_request_size: max_request_size) if max_request_size
        conn.request(:elastomer_compress, compression: compression) if compress_body

        if @adapter.is_a?(Array)
          conn.adapter(*@adapter)
        else
          conn.adapter(@adapter)
        end

        conn.options[:timeout]      = read_timeout
        conn.options[:open_timeout] = open_timeout
      end
    end
def connection
      @connection ||= Faraday.new(url) do |conn|
        conn.response(:parse_json)
        # Request compressed responses from ES and decompress them
        conn.use(:gzip)
        conn.request(:encode_json)
        conn.request(:opaque_id) if @opaque_id
        conn.request(:limit_size, max_request_size: max_request_size) if max_request_size
        conn.request(:elastomer_compress, compression: compression) if compress_body

        if @adapter.is_a?(Array)
          conn.adapter(*@adapter)
        else
          conn.adapter(@adapter)
        end

        conn.options[:timeout]      = read_timeout
        conn.options[:open_timeout] = open_timeout
      end
    end
Internal: Provides access to the Faraday::Connection used by this client
 for all requests to the server.

 Returns a Faraday::Connection