Method: ElasticsearchServerless::API::Actions#update_by_query
- Defined in:
- lib/elasticsearch-serverless/api/update_by_query.rb
#update_by_query(arguments = {}) ⇒ Object
Update documents. Updates documents that match the specified query. If no query is specified, performs an update on every document in the data stream or index without modifying the source, which is useful for picking up mapping changes.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/elasticsearch-serverless/api/update_by_query.rb', line 82 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) || {} body = arguments.delete(:body) _index = arguments.delete(:index) method = ElasticsearchServerless::API::HTTP_POST path = "#{Utils.listify(_index)}/_update_by_query" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end |