in lib/elasticsearch-serverless/api/update.rb [65:102]
def update(arguments = {})
request_opts = { endpoint: arguments[:endpoint] || 'update' }
defined_params = [:index, :id].each_with_object({}) do |variable, set_variables|
set_variables[variable] = arguments[variable] if arguments.key?(variable)
end
request_opts[:defined_params] = defined_params unless defined_params.empty?
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
raise ArgumentError, "Required argument 'id' missing" unless arguments[:id]
arguments = arguments.clone
headers = arguments.delete(:headers) || {}
body = arguments.delete(:body)
_id = arguments.delete(:id)
_index = arguments.delete(:index)
method = ElasticsearchServerless::API::HTTP_POST
path = "#{Utils.listify(_index)}/_update/#{Utils.listify(_id)}"
params = Utils.process_params(arguments)
if Array(arguments[:ignore]).include?(404)
Utils.rescue_from_not_found do
ElasticsearchServerless::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
else
ElasticsearchServerless::API::Response.new(
perform_request(method, path, params, body, headers, request_opts)
)
end
end