lib/elasticsearch/api/actions/indices/stats.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/indices/stats.rb in elasticsearch-api-8.13.0
- old
+ new
@@ -35,18 +35,17 @@
# @option arguments [Boolean] :include_unloaded_segments If set to true segment stats will include stats for segments that are not currently loaded into memory
# @option arguments [String] :expand_wildcards Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
# @option arguments [Boolean] :forbid_closed_indices If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices
# @option arguments [Hash] :headers Custom HTTP headers
#
- # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/indices-stats.html
+ # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/indices-stats.html
#
def stats(arguments = {})
- request_opts = { endpoint: arguments[:endpoint] || "indices.stats" }
+ request_opts = { endpoint: arguments[:endpoint] || 'indices.stats' }
- defined_params = [:metric, :index].inject({}) do |set_variables, variable|
+ defined_params = %i[metric 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?
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
@@ -63,10 +62,10 @@
elsif _metric
"_stats/#{Utils.__listify(_metric)}"
elsif _index
"#{Utils.__listify(_index)}/_stats"
else
- "_stats"
+ '_stats'
end
params = Utils.process_params(arguments)
Elasticsearch::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)