lib/elasticsearch/api/actions/get.rb in elasticsearch-api-8.10.0 vs lib/elasticsearch/api/actions/get.rb in elasticsearch-api-8.11.0
- old
+ new
@@ -36,13 +36,21 @@
# @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)
# @option arguments [Hash] :headers Custom HTTP headers
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-get.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/docs-get.html
#
def get(arguments = {})
+ request_opts = { endpoint: arguments[:endpoint] || "get" }
+
+ defined_params = [:index, :id].inject({}) do |set_variables, variable|
+ set_variables[variable] = arguments[variable] if arguments.key?(variable)
+ set_variables
+ end
+ request_opts[:defined_params] = defined_params unless defined_params.empty?
+
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
@@ -58,15 +66,15 @@
params = Utils.process_params(arguments)
if Array(arguments[:ignore]).include?(404)
Utils.__rescue_from_not_found {
Elasticsearch::API::Response.new(
- perform_request(method, path, params, body, headers)
+ perform_request(method, path, params, body, headers, request_opts)
)
}
else
Elasticsearch::API::Response.new(
- perform_request(method, path, params, body, headers)
+ perform_request(method, path, params, body, headers, request_opts)
)
end
end
end
end