elasticsearch-transport 6.8.3 → 7.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -0
  3. data/LICENSE.txt +199 -10
  4. data/README.md +32 -86
  5. data/Rakefile +23 -4
  6. data/elasticsearch-transport.gemspec +78 -45
  7. data/lib/elasticsearch-transport.rb +16 -3
  8. data/lib/elasticsearch/transport.rb +17 -3
  9. data/lib/elasticsearch/transport/client.rb +70 -174
  10. data/lib/elasticsearch/transport/redacted.rb +5 -9
  11. data/lib/elasticsearch/transport/transport/base.rb +63 -55
  12. data/lib/elasticsearch/transport/transport/connections/collection.rb +16 -3
  13. data/lib/elasticsearch/transport/transport/connections/connection.rb +16 -3
  14. data/lib/elasticsearch/transport/transport/connections/selector.rb +16 -3
  15. data/lib/elasticsearch/transport/transport/errors.rb +16 -3
  16. data/lib/elasticsearch/transport/transport/http/curb.rb +18 -5
  17. data/lib/elasticsearch/transport/transport/http/faraday.rb +18 -5
  18. data/lib/elasticsearch/transport/transport/http/manticore.rb +17 -4
  19. data/lib/elasticsearch/transport/transport/loggable.rb +85 -0
  20. data/lib/elasticsearch/transport/transport/response.rb +16 -3
  21. data/lib/elasticsearch/transport/transport/serializer/multi_json.rb +16 -3
  22. data/lib/elasticsearch/transport/transport/sniffer.rb +17 -5
  23. data/lib/elasticsearch/transport/version.rb +17 -4
  24. data/spec/elasticsearch/transport/base_spec.rb +8 -187
  25. data/spec/elasticsearch/transport/client_spec.rb +29 -163
  26. data/spec/elasticsearch/transport/sniffer_spec.rb +19 -0
  27. data/spec/spec_helper.rb +2 -11
  28. data/test/integration/transport_test.rb +18 -5
  29. data/test/profile/client_benchmark_test.rb +16 -3
  30. data/test/test_helper.rb +63 -14
  31. data/test/unit/connection_collection_test.rb +17 -4
  32. data/test/unit/connection_selector_test.rb +17 -4
  33. data/test/unit/connection_test.rb +17 -4
  34. data/test/unit/response_test.rb +18 -5
  35. data/test/unit/serializer_test.rb +17 -4
  36. data/test/unit/transport_base_test.rb +21 -8
  37. data/test/unit/transport_curb_test.rb +17 -4
  38. data/test/unit/transport_faraday_test.rb +17 -4
  39. data/test/unit/transport_manticore_test.rb +24 -6
  40. metadata +61 -86
  41. data/spec/elasticsearch/transport/meta_header_spec.rb +0 -214
@@ -1,7 +1,3 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
4
-
5
1
  # Licensed to Elasticsearch B.V. under one or more contributor
6
2
  # license agreements. See the NOTICE file distributed with
7
3
  # this work for additional information regarding copyright
@@ -25,7 +21,7 @@ module Elasticsearch
25
21
  # Class for wrapping a hash that could have sensitive data.
26
22
  # When printed, the sensitive values will be redacted.
27
23
  #
28
- # @since 6.2.0
24
+ # @since 6.1.1
29
25
  class Redacted < ::Hash
30
26
 
31
27
  def initialize(elements = nil)
@@ -35,20 +31,20 @@ module Elasticsearch
35
31
 
36
32
  # The keys whose values will be redacted.
37
33
  #
38
- # @since 6.2.0
34
+ # @since 6.1.1
39
35
  SENSITIVE_KEYS = [ :password,
40
36
  :pwd ].freeze
41
37
 
42
38
  # The replacement string used in place of the value for sensitive keys.
43
39
  #
44
- # @since 6.2.0
40
+ # @since 6.1.1
45
41
  STRING_REPLACEMENT = '<REDACTED>'.freeze
46
42
 
47
43
  # Get a string representation of the hash.
48
44
  #
49
45
  # @return [ String ] The string representation of the hash.
50
46
  #
51
- # @since 6.2.0
47
+ # @since 6.1.1
52
48
  def inspect
53
49
  redacted_string(:inspect)
54
50
  end
@@ -57,7 +53,7 @@ module Elasticsearch
57
53
  #
58
54
  # @return [ String ] The string representation of the hash.
59
55
  #
60
- # @since 6.2.0
56
+ # @since 6.1.1
61
57
  def to_s
62
58
  redacted_string(:to_s)
63
59
  end
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -9,6 +22,8 @@ module Elasticsearch
9
22
  # @abstract Module with common functionality for transport implementations.
10
23
  #
11
24
  module Base
25
+ include Loggable
26
+
12
27
  DEFAULT_PORT = 9200
13
28
  DEFAULT_PROTOCOL = 'http'
14
29
  DEFAULT_RELOAD_AFTER = 10_000 # Requests
@@ -20,7 +35,7 @@ module Elasticsearch
20
35
  attr_reader :hosts, :options, :connections, :counter, :last_request_at, :protocol
21
36
  attr_accessor :serializer, :sniffer, :logger, :tracer,
22
37
  :reload_connections, :reload_after,
23
- :resurrect_after
38
+ :resurrect_after, :max_retries
24
39
 
25
40
  # Creates a new transport object
26
41
  #
@@ -36,7 +51,7 @@ module Elasticsearch
36
51
  @state_mutex = Mutex.new
37
52
 
38
53
  @hosts = arguments[:hosts] || []
39
- @options = arguments[:options] ? arguments[:options].dup : {}
54
+ @options = arguments[:options] || {}
40
55
  @options[:http] ||= {}
41
56
  @options[:retry_on_status] ||= []
42
57
 
@@ -56,6 +71,7 @@ module Elasticsearch
56
71
  @reload_connections = options[:reload_connections]
57
72
  @reload_after = options[:reload_connections].is_a?(Integer) ? options[:reload_connections] : DEFAULT_RELOAD_AFTER
58
73
  @resurrect_after = options[:resurrect_after] || DEFAULT_RESURRECT_AFTER
74
+ @max_retries = options[:retry_on_failure].is_a?(Integer) ? options[:retry_on_failure] : DEFAULT_MAX_RETRIES
59
75
  @retry_on_status = Array(options[:retry_on_status]).map { |d| d.to_i }
60
76
  end
61
77
 
@@ -84,7 +100,7 @@ module Elasticsearch
84
100
  __rebuild_connections :hosts => hosts, :options => options
85
101
  self
86
102
  rescue SnifferTimeoutError
87
- logger.error "[SnifferTimeoutError] Timeout when reloading connections." if logger
103
+ log_error "[SnifferTimeoutError] Timeout when reloading connections."
88
104
  self
89
105
  end
90
106
 
@@ -131,15 +147,15 @@ module Elasticsearch
131
147
  def __build_connections
132
148
  Connections::Collection.new \
133
149
  :connections => hosts.map { |host|
134
- host[:protocol] = host[:scheme] || options[:scheme] || options[:http][:scheme] || DEFAULT_PROTOCOL
135
- host[:port] ||= options[:port] || options[:http][:port] || DEFAULT_PORT
136
- if (options[:user] || options[:http][:user]) && !host[:user]
137
- host[:user] ||= options[:user] || options[:http][:user]
138
- host[:password] ||= options[:password] || options[:http][:password]
139
- end
150
+ host[:protocol] = host[:scheme] || options[:scheme] || options[:http][:scheme] || DEFAULT_PROTOCOL
151
+ host[:port] ||= options[:port] || options[:http][:port] || DEFAULT_PORT
152
+ if (options[:user] || options[:http][:user]) && !host[:user]
153
+ host[:user] ||= options[:user] || options[:http][:user]
154
+ host[:password] ||= options[:password] || options[:http][:password]
155
+ end
140
156
 
141
- __build_connection(host, (options[:transport_options] || {}), @block)
142
- },
157
+ __build_connection(host, (options[:transport_options] || {}), @block)
158
+ },
143
159
  :selector_class => options[:selector_class],
144
160
  :selector => options[:selector]
145
161
  end
@@ -167,20 +183,14 @@ module Elasticsearch
167
183
  #
168
184
  # @api private
169
185
  #
170
- def __log(method, path, params, body, url, response, json, took, duration)
171
- sanitized_url = url.to_s.gsub(/\/\/(.+):(.+)@/, '//' + '\1:' + SANITIZED_PASSWORD + '@')
172
- logger.info "#{method.to_s.upcase} #{sanitized_url} " +
173
- "[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]"
174
- logger.debug "> #{__convert_to_json(body)}" if body
175
- logger.debug "< #{response.body}"
176
- end
177
-
178
- # Log failed request
179
- #
180
- # @api private
181
- #
182
- def __log_failed(response)
183
- logger.fatal "[#{response.status}] #{response.body}"
186
+ def __log_response(method, path, params, body, url, response, json, took, duration)
187
+ if logger
188
+ sanitized_url = url.to_s.gsub(/\/\/(.+):(.+)@/, '//' + '\1:' + SANITIZED_PASSWORD + '@')
189
+ log_info "#{method.to_s.upcase} #{sanitized_url} " +
190
+ "[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]"
191
+ log_debug "> #{__convert_to_json(body)}" if body
192
+ log_debug "< #{response.body}"
193
+ end
184
194
  end
185
195
 
186
196
  # Trace the request in the `curl` format
@@ -189,7 +199,7 @@ module Elasticsearch
189
199
  #
190
200
  def __trace(method, path, params, headers, body, url, response, json, took, duration)
191
201
  trace_url = "http://localhost:9200/#{path}?pretty" +
192
- ( params.empty? ? '' : "&#{::Faraday::Utils::ParamsHash[params].to_query}" )
202
+ ( params.empty? ? '' : "&#{::Faraday::Utils::ParamsHash[params].to_query}" )
193
203
  trace_body = body ? " -d '#{__convert_to_json(body, :pretty => true)}'" : ''
194
204
  trace_command = "curl -X #{method.to_s.upcase}"
195
205
  trace_command += " -H '#{headers.inject('') { |memo,item| memo << item[0] + ': ' + item[1] }}'" if headers && !headers.empty?
@@ -247,17 +257,10 @@ module Elasticsearch
247
257
  # @raise [ServerError] If request failed on server
248
258
  # @raise [Error] If no connection is available
249
259
  #
250
- def perform_request(method, path, params={}, body=nil, headers=nil, opts={}, &block)
260
+ def perform_request(method, path, params={}, body=nil, headers=nil, &block)
251
261
  raise NoMethodError, "Implement this method in your transport class" unless block_given?
252
- start = Time.now if logger || tracer
262
+ start = Time.now
253
263
  tries = 0
254
- reload_on_failure = opts.fetch(:reload_on_failure, @options[:reload_on_failure])
255
-
256
- max_retries = if opts.key?(:retry_on_failure)
257
- opts[:retry_on_failure] === true ? DEFAULT_MAX_RETRIES : opts[:retry_on_failure]
258
- elsif options.key?(:retry_on_failure)
259
- options[:retry_on_failure] === true ? DEFAULT_MAX_RETRIES : options[:retry_on_failure]
260
- end
261
264
 
262
265
  params = params.clone
263
266
 
@@ -281,12 +284,12 @@ module Elasticsearch
281
284
  __raise_transport_error(response) if response.status.to_i >= 300 && @retry_on_status.include?(response.status.to_i)
282
285
 
283
286
  rescue Elasticsearch::Transport::Transport::ServerError => e
284
- if response && @retry_on_status.include?(response.status)
285
- logger.warn "[#{e.class}] Attempt #{tries} to get response from #{url}" if logger
286
- if tries <= (max_retries || DEFAULT_MAX_RETRIES)
287
+ if @retry_on_status.include?(response.status)
288
+ log_warn "[#{e.class}] Attempt #{tries} to get response from #{url}"
289
+ if tries <= max_retries
287
290
  retry
288
291
  else
289
- logger.fatal "[#{e.class}] Cannot get response from #{url} after #{tries} tries" if logger
292
+ log_fatal "[#{e.class}] Cannot get response from #{url} after #{tries} tries"
290
293
  raise e
291
294
  end
292
295
  else
@@ -294,21 +297,21 @@ module Elasticsearch
294
297
  end
295
298
 
296
299
  rescue *host_unreachable_exceptions => e
297
- logger.error "[#{e.class}] #{e.message} #{connection.host.inspect}" if logger
300
+ log_error "[#{e.class}] #{e.message} #{connection.host.inspect}"
298
301
 
299
302
  connection.dead!
300
303
 
301
- if reload_on_failure and tries < connections.all.size
302
- logger.warn "[#{e.class}] Reloading connections (attempt #{tries} of #{connections.all.size})" if logger
304
+ if @options[:reload_on_failure] and tries < connections.all.size
305
+ log_warn "[#{e.class}] Reloading connections (attempt #{tries} of #{connections.all.size})"
303
306
  reload_connections! and retry
304
307
  end
305
308
 
306
- if max_retries
307
- logger.warn "[#{e.class}] Attempt #{tries} connecting to #{connection.host.inspect}" if logger
309
+ if @options[:retry_on_failure]
310
+ log_warn "[#{e.class}] Attempt #{tries} connecting to #{connection.host.inspect}"
308
311
  if tries <= max_retries
309
312
  retry
310
313
  else
311
- logger.fatal "[#{e.class}] Cannot connect to #{connection.host.inspect} after #{tries} tries" if logger
314
+ log_fatal "[#{e.class}] Cannot connect to #{connection.host.inspect} after #{tries} tries"
312
315
  raise e
313
316
  end
314
317
  else
@@ -316,27 +319,32 @@ module Elasticsearch
316
319
  end
317
320
 
318
321
  rescue Exception => e
319
- logger.fatal "[#{e.class}] #{e.message} (#{connection.host.inspect if connection})" if logger
322
+ log_fatal "[#{e.class}] #{e.message} (#{connection.host.inspect if connection})"
320
323
  raise e
321
324
 
322
325
  end #/begin
323
326
 
324
- duration = Time.now-start if logger || tracer
327
+ duration = Time.now - start
325
328
 
326
329
  if response.status.to_i >= 300
327
- __log method, path, params, body, url, response, nil, 'N/A', duration if logger
330
+ __log_response method, path, params, body, url, response, nil, 'N/A', duration
328
331
  __trace method, path, params, headers, body, url, response, nil, 'N/A', duration if tracer
329
332
 
330
333
  # Log the failure only when `ignore` doesn't match the response status
331
- __log_failed response if logger && !ignore.include?(response.status.to_i)
334
+ unless ignore.include?(response.status.to_i)
335
+ log_fatal "[#{response.status}] #{response.body}"
336
+ end
332
337
 
333
338
  __raise_transport_error response unless ignore.include?(response.status.to_i)
334
339
  end
335
340
 
336
341
  json = serializer.load(response.body) if response.body && !response.body.empty? && response.headers && response.headers["content-type"] =~ /json/
337
- took = (json['took'] ? sprintf('%.3fs', json['took']/1000.0) : 'n/a') rescue 'n/a' if logger || tracer
342
+ took = (json['took'] ? sprintf('%.3fs', json['took']/1000.0) : 'n/a') rescue 'n/a'
343
+
344
+ unless ignore.include?(response.status.to_i)
345
+ __log_response method, path, params, body, url, response, json, took, duration
346
+ end
338
347
 
339
- __log method, path, params, body, url, response, json, took, duration if logger && !ignore.include?(response.status.to_i)
340
348
  __trace method, path, params, headers, body, url, response, json, took, duration if tracer
341
349
 
342
350
  Response.new response.status, json || response.body, response.headers
@@ -355,4 +363,4 @@ module Elasticsearch
355
363
  end
356
364
  end
357
365
  end
358
- end
366
+ end
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -19,9 +32,9 @@ module Elasticsearch
19
32
  # @return [Response]
20
33
  # @see Transport::Base#perform_request
21
34
  #
22
- def perform_request(method, path, params={}, body=nil, headers=nil, opts={})
35
+ def perform_request(method, path, params={}, body=nil, headers=nil)
23
36
  super do |connection, url|
24
- connection.connection.url = url
37
+ connection.connection.url = connection.full_url(path, params)
25
38
 
26
39
  case method
27
40
  when 'HEAD'
@@ -1,6 +1,19 @@
1
- # Licensed to Elasticsearch B.V under one or more agreements.
2
- # Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
- # See the LICENSE file in the project root for more information
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
4
17
 
5
18
  module Elasticsearch
6
19
  module Transport
@@ -20,7 +33,7 @@ module Elasticsearch
20
33
  # @return [Response]
21
34
  # @see Transport::Base#perform_request
22
35
  #
23
- def perform_request(method, path, params={}, body=nil, headers=nil, opts={})
36
+ def perform_request(method, path, params={}, body=nil, headers=nil)
24
37
  super do |connection, url|
25
38
  headers = headers || connection.connection.headers
26
39
 
@@ -47,7 +60,7 @@ module Elasticsearch
47
60
  # @return [Array]
48
61
  #
49
62
  def host_unreachable_exceptions
50
- [::Faraday::ConnectionFailed, ::Faraday::TimeoutError]
63
+ [::Faraday::Error::ConnectionFailed, ::Faraday::Error::TimeoutError]
51
64
  end
52
65
  end
53
66
  end