lib/elasticsearch/api/actions/fleet/search.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/fleet/search.rb in elasticsearch-api-8.13.0
- old
+ new
@@ -36,33 +36,32 @@
# @option arguments [Hash] :body The search definition using the Query DSL
#
# @see [TODO]
#
def search(arguments = {})
- request_opts = { endpoint: arguments[:endpoint] || "fleet.search" }
+ request_opts = { endpoint: arguments[:endpoint] || 'fleet.search' }
- defined_params = [:index].inject({}) do |set_variables, variable|
+ defined_params = [:index].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]
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
- body = arguments.delete(:body)
+ body = arguments.delete(:body)
_index = arguments.delete(:index)
method = if body
Elasticsearch::API::HTTP_POST
else
Elasticsearch::API::HTTP_GET
end
- path = "#{Utils.__listify(_index)}/_fleet/_fleet_search"
+ path = "#{Utils.__listify(_index)}/_fleet/_fleet_search"
params = Utils.process_params(arguments)
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)