lib/elasticsearch/api/actions/get.rb in elasticsearch-api-7.6.0 vs lib/elasticsearch/api/actions/get.rb in elasticsearch-api-7.7.0.pre
- old
+ new
@@ -20,22 +20,25 @@
# @option arguments [List] :_source_includes A list of fields to extract and return from the _source field
# @option arguments [Number] :version Explicit version number for concurrency control
# @option arguments [String] :version_type Specific version type
# (options: internal,external,external_gte,force)
+ # @option arguments [Hash] :headers Custom HTTP headers
#
# *Deprecation notice*:
# Specifying types in urls has been deprecated
# Deprecated since version 7.0.0
#
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-get.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-get.html
#
def get(arguments = {})
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
+ headers = arguments.delete(:headers) || {}
+
arguments = arguments.clone
_id = arguments.delete(:id)
_index = arguments.delete(:index)
@@ -50,12 +53,12 @@
end
params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
body = nil
if Array(arguments[:ignore]).include?(404)
- Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body, headers).body }
else
- perform_request(method, path, params, body).body
+ perform_request(method, path, params, body, headers).body
end
end
# Register this action with its valid params when the module is loaded.
#