lib/elasticsearch/api/actions/exists.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/exists.rb in elasticsearch-api-8.13.0
- old
+ new
@@ -35,18 +35,17 @@
# @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.12/docs-get.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/docs-get.html
#
def exists(arguments = {})
- request_opts = { endpoint: arguments[:endpoint] || "exists" }
+ request_opts = { endpoint: arguments[:endpoint] || 'exists' }
- defined_params = [:index, :id].inject({}) do |set_variables, variable|
+ defined_params = %i[index id].each_with_object({}) do |variable, set_variables|
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]
@@ -63,13 +62,13 @@
method = Elasticsearch::API::HTTP_HEAD
path = "#{Utils.__listify(_index)}/_doc/#{Utils.__listify(_id)}"
params = Utils.process_params(arguments)
Utils.__rescue_from_not_found do
- perform_request(method, path, params, body, headers, request_opts).status == 200 ? true : false
+ perform_request(method, path, params, body, headers, request_opts).status == 200
end
end
- alias_method :exists?, :exists
+ alias exists? exists
end
end
end