Class: ElastomerClient::Client::UpdateByQuery
- Inherits:
-
Object
- Object
- ElastomerClient::Client::UpdateByQuery
- Defined in:
- lib/elastomer_client/client/update_by_query.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(client, query, parameters) ⇒ UpdateByQuery
constructor
A new instance of UpdateByQuery.
Constructor Details
#initialize(client, query, parameters) ⇒ UpdateByQuery
Returns a new instance of UpdateByQuery.
35 36 37 38 39 |
# File 'lib/elastomer_client/client/update_by_query.rb', line 35 def initialize(client, query, parameters) @client = client @query = query @parameters = parameters end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
33 34 35 |
# File 'lib/elastomer_client/client/update_by_query.rb', line 33 def client @client end |
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
33 34 35 |
# File 'lib/elastomer_client/client/update_by_query.rb', line 33 def parameters @parameters end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
33 34 35 |
# File 'lib/elastomer_client/client/update_by_query.rb', line 33 def query @query end |
Instance Method Details
#execute ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/elastomer_client/client/update_by_query.rb', line 41 def execute # TODO: Require index parameter. type is optional. updated_params = parameters.merge(body: query, action: "update_by_query", rest_api: "update_by_query") updated_params.delete(:type) if client.version_support.es_version_8_plus? response = client.post("/{index}{/type}/_update_by_query", updated_params) response.body end |