lib/elasticsearch/api/actions/reindex_rethrottle.rb in elasticsearch-api-7.4.0 vs lib/elasticsearch/api/actions/reindex_rethrottle.rb in elasticsearch-api-7.5.0.pre.pre

- old
+ new

@@ -3,31 +3,37 @@ # See the LICENSE file in the project root for more information module Elasticsearch module API module Actions + # Changes the number of requests per second for a particular Reindex operation. + # + # @option arguments [String] :task_id The task id to rethrottle + # @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. (*Required*) - # The value of requests_per_second can be changed on a running reindex using the _rethrottle # - # @option arguments [String] :task_id The task id to rethrottle (*Required*) - # @option arguments [Number] :requests_per_second The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docs-reindex.html # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html - # - def reindex_rethrottle(arguments={}) + def reindex_rethrottle(arguments = {}) raise ArgumentError, "Required argument 'task_id' missing" unless arguments[:task_id] + + arguments = arguments.clone + + _task_id = arguments.delete(:task_id) + method = Elasticsearch::API::HTTP_POST - path = "_reindex/#{arguments[:task_id]}/_rethrottle" - params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) - body = nil + path = "_reindex/#{Utils.__listify(_task_id)}/_rethrottle" + params = Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__) + 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(:reindex_rethrottle, [ - :requests_per_second ].freeze) + :requests_per_second + ].freeze) end - end -end \ No newline at end of file + end +end