lib/elasticsearch/api/actions/indices/stats.rb in elasticsearch-api-6.1.0 vs lib/elasticsearch/api/actions/indices/stats.rb in elasticsearch-api-6.2.0

- old
+ new

@@ -74,50 +74,55 @@ # @option arguments [Boolean] :include_segment_file_sizes Whether to report the aggregated disk usage of each one of the Lucene index files. Only applies if segment stats are requested. (default: false) # # @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-stats.html # def stats(arguments={}) - valid_parts = [ - :docs, - :fielddata, - :filter_cache, - :flush, - :get, - :indexing, - :merge, - :metric, - :refresh, - :search, - :suggest, - :store, - :warmer ] + method = HTTP_GET + parts = Utils.__extract_parts arguments, ParamsRegistry.get(:stats_parts) + path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts) - valid_params = [ + params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(:stats_params) + params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields] + params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups] + + body = nil + + perform_request(method, path, params, body).body + end + + # Register this action with its valid params when the module is loaded. + # + # @since 6.2.0 + ParamsRegistry.register(:stats_params, [ :fields, :completion_fields, :fielddata_fields, :groups, :level, :types, :ignore_indices, :ignore_unavailable, :allow_no_indices, :expand_wildcards, - :include_segment_file_sizes ] + :include_segment_file_sizes ].freeze) - method = HTTP_GET - - parts = Utils.__extract_parts arguments, valid_parts - path = Utils.__pathify Utils.__listify(arguments[:index]), '_stats', Utils.__listify(parts) - - params = Utils.__validate_and_extract_params arguments, valid_params - params[:fields] = Utils.__listify(params[:fields], :escape => false) if params[:fields] - params[:groups] = Utils.__listify(params[:groups], :escape => false) if params[:groups] - - body = nil - - perform_request(method, path, params, body).body - end + # Register this action with its valid parts when the module is loaded. + # + # @since 6.2.0 + ParamsRegistry.register(:stats_parts, [ + :docs, + :fielddata, + :filter_cache, + :flush, + :get, + :indexing, + :merge, + :metric, + :refresh, + :search, + :suggest, + :store, + :warmer ].freeze) end end end end