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

- old
+ new

@@ -30,13 +30,21 @@ # @option arguments [Time] :master_timeout Specify timeout for connection to master # @option arguments [String] :wait_for_active_shards Set the number of active shards to wait for on the cloned index before the operation returns. # @option arguments [Hash] :headers Custom HTTP headers # @option arguments [Hash] :body The configuration for the target index (`settings` and `aliases`) # - # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-clone-index.html + # @see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/indices-clone-index.html # def clone(arguments = {}) + request_opts = { endpoint: arguments[:endpoint] || "indices.clone" } + + defined_params = [:index, :target].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] raise ArgumentError, "Required argument 'target' missing" unless arguments[:target] arguments = arguments.clone headers = arguments.delete(:headers) || {} @@ -50,10 +58,10 @@ method = Elasticsearch::API::HTTP_PUT path = "#{Utils.__listify(_index)}/_clone/#{Utils.__listify(_target)}" 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