Module: ElasticsearchServerless::API::Transform::Actions
- Defined in:
- lib/elasticsearch-serverless/api/transform/get_transform.rb,
lib/elasticsearch-serverless/api/transform/put_transform.rb,
lib/elasticsearch-serverless/api/transform/stop_transform.rb,
lib/elasticsearch-serverless/api/transform/reset_transform.rb,
lib/elasticsearch-serverless/api/transform/start_transform.rb,
lib/elasticsearch-serverless/api/transform/delete_transform.rb,
lib/elasticsearch-serverless/api/transform/update_transform.rb,
lib/elasticsearch-serverless/api/transform/preview_transform.rb,
lib/elasticsearch-serverless/api/transform/get_transform_stats.rb,
lib/elasticsearch-serverless/api/transform/schedule_now_transform.rb
Instance Method Summary collapse
-
#delete_transform(arguments = {}) ⇒ Object
Deletes a transform.
-
#get_transform(arguments = {}) ⇒ Object
Retrieves configuration information for transforms.
-
#get_transform_stats(arguments = {}) ⇒ Object
Retrieves usage information for transforms.
-
#preview_transform(arguments = {}) ⇒ Object
Previews a transform.
-
#put_transform(arguments = {}) ⇒ Object
Creates a transform.
-
#reset_transform(arguments = {}) ⇒ Object
Resets a transform.
-
#schedule_now_transform(arguments = {}) ⇒ Object
Schedules now a transform.
-
#start_transform(arguments = {}) ⇒ Object
Starts a transform.
-
#stop_transform(arguments = {}) ⇒ Object
Stops one or more transforms.
-
#update_transform(arguments = {}) ⇒ Object
Updates certain properties of a transform.
Instance Method Details
#delete_transform(arguments = {}) ⇒ Object
Deletes a transform.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch-serverless/api/transform/delete_transform.rb', line 35 def delete_transform(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_DELETE path = "_transform/#{Utils.listify(_transform_id)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#get_transform(arguments = {}) ⇒ Object
Retrieves configuration information for transforms.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elasticsearch-serverless/api/transform/get_transform.rb', line 36 def get_transform(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_GET path = if _transform_id "_transform/#{Utils.listify(_transform_id)}" else "_transform" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#get_transform_stats(arguments = {}) ⇒ Object
Retrieves usage information for transforms.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elasticsearch-serverless/api/transform/get_transform_stats.rb', line 36 def get_transform_stats(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_GET path = "_transform/#{Utils.listify(_transform_id)}/_stats" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#preview_transform(arguments = {}) ⇒ Object
Previews a transform.
It returns a maximum of 100 results. The calculations are based on all the current data in the source index. It also generates a list of mappings and settings for the destination index. These values are determined based on the field types of the source index and the transform aggregations.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/elasticsearch-serverless/api/transform/preview_transform.rb', line 38 def preview_transform(arguments = {}) arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _transform_id = arguments.delete(:transform_id) method = if body ElasticsearchServerless::API::HTTP_POST else ElasticsearchServerless::API::HTTP_GET end path = if _transform_id "_transform/#{Utils.listify(_transform_id)}/_preview" else "_transform/_preview" end params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#put_transform(arguments = {}) ⇒ Object
Creates a transform.
A transform copies data from source indices, transforms it, and persists it into an entity-centric destination index. You can also think of the destination index as a two-dimensional tabular data structure (known as a data frame). The ID for each document in the data frame is generated from a hash of the entity, so there is a unique row per entity.
You must choose either the latest or pivot method for your transform; you cannot use both in a single transform. If you choose to use the pivot method for your transform, the entities are defined by the set of group_by fields in the pivot object. If you choose to use the latest method, the entities are defined by the unique_key field values in the latest object.
You must have create_index, index, and read privileges on the destination index and read and view_index_metadata privileges on the source indices. When Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the time of creation and uses those same roles. If those roles do not have the required privileges on the source and destination indices, the transform fails when it attempts unauthorized operations.
NOTE: You must use Kibana or this API to create a transform. Do not add a transform directly into any .transform-internal* indices using the Elasticsearch index API. If Elasticsearch security features are enabled, do not give users any privileges on .transform-internal* indices. If you used transforms prior to 7.5, also do not give users any privileges on .data-frame-internal* indices.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/elasticsearch-serverless/api/transform/put_transform.rb', line 55 def put_transform(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_PUT path = "_transform/#{Utils.listify(_transform_id)}" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#reset_transform(arguments = {}) ⇒ Object
Resets a transform. Before you can reset it, you must stop it; alternatively, use the force query parameter. If the destination index was created by the transform, it is deleted.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/elasticsearch-serverless/api/transform/reset_transform.rb', line 35 def reset_transform(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_reset" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#schedule_now_transform(arguments = {}) ⇒ Object
Schedules now a transform.
If you _schedule_now a transform, it will process the new data instantly, without waiting for the configured frequency interval. After _schedule_now API is called, the transform will be processed again at now + frequency unless _schedule_now API is called again in the meantime.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/elasticsearch-serverless/api/transform/schedule_now_transform.rb', line 38 def schedule_now_transform(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_schedule_now" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#start_transform(arguments = {}) ⇒ Object
Starts a transform.
When you start a transform, it creates the destination index if it does not already exist. The number_of_shards is set to 1 and the auto_expand_replicas is set to 0-1. If it is a pivot transform, it deduces the mapping definitions for the destination index from the source indices and the transform aggregations. If fields in the destination index are derived from scripts (as in the case of scripted_metric or bucket_script aggregations), the transform uses dynamic mappings unless an index template exists. If it is a latest transform, it does not deduce mapping definitions; it uses dynamic mappings. To use explicit mappings, create the destination index before you start the transform. Alternatively, you can create an index template, though it does not affect the deduced mappings in a pivot transform.
When the transform starts, a series of validations occur to ensure its success. If you deferred validation when you created the transform, they occur when you start the transform—with the exception of privilege checks. When Elasticsearch security features are enabled, the transform remembers which roles the user that created it had at the time of creation and uses those same roles. If those roles do not have the required privileges on the source and destination indices, the transform fails when it attempts unauthorized operations.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/elasticsearch-serverless/api/transform/start_transform.rb', line 49 def start_transform(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_start" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#stop_transform(arguments = {}) ⇒ Object
Stops one or more transforms.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/elasticsearch-serverless/api/transform/stop_transform.rb', line 37 def stop_transform(arguments = {}) raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_stop" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |
#update_transform(arguments = {}) ⇒ Object
Updates certain properties of a transform.
All updated properties except description do not take effect until after the transform starts the next checkpoint, thus there is data consistency in each checkpoint. To use this API, you must have read and view_index_metadata privileges for the source indices. You must also have index and read privileges for the destination index. When Elasticsearch security features are enabled, the transform remembers which roles the user who updated it had at the time of update and runs with those privileges.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/elasticsearch-serverless/api/transform/update_transform.rb', line 41 def update_transform(arguments = {}) raise ArgumentError, "Required argument 'body' missing" unless arguments[:body] raise ArgumentError, "Required argument 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _transform_id = arguments.delete(:transform_id) method = ElasticsearchServerless::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_update" params = Utils.process_params(arguments) ElasticsearchServerless::API::Response.new( perform_request(method, path, params, body, headers) ) end |