lib/elasticsearch/api/actions/cat/indices.rb in elasticsearch-api-8.12.2 vs lib/elasticsearch/api/actions/cat/indices.rb in elasticsearch-api-8.13.0

- old
+ new

@@ -37,18 +37,17 @@ # @option arguments [Boolean] :v Verbose mode. Display column headers # @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 [Hash] :headers Custom HTTP headers # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.12/cat-indices.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.13/cat-indices.html # def indices(arguments = {}) - request_opts = { endpoint: arguments[:endpoint] || "cat.indices" } + request_opts = { endpoint: arguments[:endpoint] || 'cat.indices' } - 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? arguments = arguments.clone headers = arguments.delete(:headers) || {} @@ -59,10 +58,10 @@ method = Elasticsearch::API::HTTP_GET path = if _index "_cat/indices/#{Utils.__listify(_index)}" else - "_cat/indices" + '_cat/indices' end params = Utils.process_params(arguments) params[:h] = Utils.__listify(params[:h]) if params[:h] Elasticsearch::API::Response.new(