lib/elasticsearch/api/actions/update_by_query.rb in elasticsearch-api-8.10.0 vs lib/elasticsearch/api/actions/update_by_query.rb in elasticsearch-api-8.11.0

- old
+ new

@@ -57,13 +57,21 @@ # @option arguments [Number] :requests_per_second The throttle to set on this request in sub-requests per second. -1 means no throttle. # @option arguments [Number|string] :slices The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The search definition using the Query DSL # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-update-by-query.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/docs-update-by-query.html # def update_by_query(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "update_by_query" } + + defined_params = [:index].inject({}) do |set_variables, variable| + 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) || {} @@ -74,10 +82,10 @@ method = Elasticsearch::API::HTTP_POST path = "#{Utils.__listify(_index)}/_update_by_query" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( - perform_request(method, path, params, body, headers) + perform_request(method, path, params, body, headers, request_opts) ) end end end end