module Elasticsearch::API::Transform::Actions
Public Instance Methods
Source
# File lib/elasticsearch/api/actions/transform/delete_transform.rb, line 37 def delete_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.delete_transform' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_DELETE path = "_transform/#{Utils.listify(_transform_id)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Delete a transform.
@option arguments [String] :transform_id Identifier for the transform. (Required) @option arguments [Boolean] :force If this value is false, the transform must be stopped before it can be deleted. If true, the transform is
deleted regardless of its current state.
@option arguments [Boolean] :delete_dest_index If this value is true, the destination index is deleted together with the transform. If false, the destination
index will not be deleted
@option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-delete-transform
Source
# File lib/elasticsearch/api/actions/transform/get_node_stats.rb, line 31 def get_node_stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.get_node_stats' } arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) method = if body Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = '_transform/_node_stats' params = {} Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Retrieves transform usage information for transform nodes.
@option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/guide/en/elasticsearch/reference/current/get-transform-node-stats.html
Source
# File lib/elasticsearch/api/actions/transform/get_transform.rb, line 47 def get_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.get_transform' } defined_params = [:transform_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? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_GET path = if _transform_id "_transform/#{Utils.listify(_transform_id)}" else '_transform' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Get transforms. Get configuration information for transforms.
@option arguments [String, Array<String>] :transform_id Identifier for the transform. It can be a transform identifier or a
wildcard expression. You can get information for all transforms by using +_all+, by specifying +*+ as the +<transform_id>+, or by omitting the +<transform_id>+.
@option arguments [Boolean] :allow_no_match Specifies what to do when the request:
- Contains wildcard expressions and there are no transforms that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. Server default: true.
@option arguments [Integer] :from Skips the specified number of transforms. Server default: 0. @option arguments [Integer] :size Specifies the maximum number of transforms to obtain. Server default: 100. @option arguments [Boolean] :exclude_generated Excludes fields that were automatically added when creating the
transform. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.
@option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-get-transform
Source
# File lib/elasticsearch/api/actions/transform/get_transform_stats.rb, line 45 def get_transform_stats(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.get_transform_stats' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_GET path = "_transform/#{Utils.listify(_transform_id)}/_stats" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Get transform stats. Get usage information for transforms.
@option arguments [String, Array<String>] :transform_id Identifier for the transform. It can be a transform identifier or a
wildcard expression. You can get information for all transforms by using +_all+, by specifying +*+ as the +<transform_id>+, or by omitting the +<transform_id>+. (*Required*)
@option arguments [Boolean] :allow_no_match Specifies what to do when the request:
- Contains wildcard expressions and there are no transforms that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches. Server default: true.
@option arguments [Integer] :from Skips the specified number of transforms. Server default: 0. @option arguments [Integer] :size Specifies the maximum number of transforms to obtain. Server default: 100. @option arguments [Time] :timeout Controls the time to wait for the stats @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-get-transform-stats
Source
# File lib/elasticsearch/api/actions/transform/preview_transform.rb, line 40 def preview_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.preview_transform' } defined_params = [:transform_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? arguments = arguments.clone headers = arguments.delete(:headers) || {} body = arguments.delete(:body) _transform_id = arguments.delete(:transform_id) method = if body Elasticsearch::API::HTTP_POST else Elasticsearch::API::HTTP_GET end path = if _transform_id "_transform/#{Utils.listify(_transform_id)}/_preview" else '_transform/_preview' end params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Preview a transform. Generates a preview of the results that you will get when you create a transform with the same configuration. 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.
@option arguments [String] :transform_id Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform
configuration details in the request body.
@option arguments [Time] :timeout Period to wait for a response. If no response is received before the
timeout expires, the request fails and returns an error. Server default: 30s.
@option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body request body
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-preview-transform
Source
# File lib/elasticsearch/api/actions/transform/put_transform.rb, line 57 def put_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.put_transform' } defined_params = [:transform_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 '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 = Elasticsearch::API::HTTP_PUT path = "_transform/#{Utils.listify(_transform_id)}" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Create a transform. 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.
@option arguments [String] :transform_id Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9),
hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. (*Required*)
@option arguments [Boolean] :defer_validation When the transform is created, a series of validations occur to ensure its success. For example, there is a
check for the existence of the source indices and a check that the destination index is not part of the source index pattern. You can use this parameter to skip the checks, for example when the source index does not exist until after the transform is created. The validations are always run when you start the transform, however, with the exception of privilege checks.
@option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s. @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body request body
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-put-transform
Source
# File lib/elasticsearch/api/actions/transform/reset_transform.rb, line 38 def reset_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.reset_transform' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_reset" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Reset 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.
@option arguments [String] :transform_id Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9),
hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters. (*Required*)
@option arguments [Boolean] :force If this value is true
, the transform is reset regardless of its current state. If it’s false
, the transform
must be stopped before it can be reset.
@option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-reset-transform
Source
# File lib/elasticsearch/api/actions/transform/schedule_now_transform.rb, line 38 def schedule_now_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.schedule_now_transform' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_schedule_now" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Schedule a transform to start now. Instantly run a transform to process data. If you run this API
, the transform will process the new data instantly, without waiting for the configured frequency interval. After the API
is called, the transform will be processed again at +now + frequency+ unless the API
is called again in the meantime.
@option arguments [String] :transform_id Identifier for the transform. (Required) @option arguments [Time] :timeout Controls the time to wait for the scheduling to take place Server default: 30s. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-schedule-now-transform
Source
# File lib/elasticsearch/api/actions/transform/start_transform.rb, line 47 def start_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.start_transform' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_start" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Start 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.
@option arguments [String] :transform_id Identifier for the transform. (Required) @option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. Server default: 30s. @option arguments [String] :from Restricts the set of transformed entities to those changed after this time. Relative times like now-30d are supported. Only applicable for continuous transforms. @option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-start-transform
Source
# File lib/elasticsearch/api/actions/transform/stop_transform.rb, line 46 def stop_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.stop_transform' } defined_params = [:transform_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 'transform_id' missing" unless arguments[:transform_id] arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil _transform_id = arguments.delete(:transform_id) method = Elasticsearch::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_stop" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Stop transforms. Stops one or more transforms.
@option arguments [String] :transform_id Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression.
To stop all transforms, use +_all+ or +*+ as the identifier. (*Required*)
@option arguments [Boolean] :allow_no_match Specifies what to do when the request: contains wildcard expressions and there are no transforms that match;
contains the +_all+ string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches.If it is true, the API returns a successful acknowledgement message when there are no matches. When there are only partial matches, the API stops the appropriate transforms.If it is false, the request returns a 404 status code when there are no matches or only partial matches. Server default: true.
@option arguments [Boolean] :force If it is true, the API
forcefully stops the transforms. @option arguments [Time] :timeout Period to wait for a response when wait_for_completion
is true
. If no response is received before the
timeout expires, the request returns a timeout exception. However, the request continues processing and eventually moves the transform to a STOPPED state. Server default: 30s.
@option arguments [Boolean] :wait_for_checkpoint If it is true, the transform does not completely stop until the current checkpoint is completed. If it is false,
the transform stops as soon as possible.
@option arguments [Boolean] :wait_for_completion If it is true, the API
blocks until the indexer state completely stops. If it is false, the API
returns
immediately and the indexer is stopped asynchronously in the background.
@option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-stop-transform
Source
# File lib/elasticsearch/api/actions/transform/update_transform.rb, line 44 def update_transform(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.update_transform' } defined_params = [:transform_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 '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 = Elasticsearch::API::HTTP_POST path = "_transform/#{Utils.listify(_transform_id)}/_update" params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Update a transform. 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.
@option arguments [String] :transform_id Identifier for the transform. (Required) @option arguments [Boolean] :defer_validation When true, deferrable validations are not run. This behavior may be
desired if the source index does not exist until after the transform is created.
@option arguments [Time] :timeout Period to wait for a response. If no response is received before the
timeout expires, the request fails and returns an error. Server default: 30s.
@option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body request body
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-update-transform
Source
# File lib/elasticsearch/api/actions/transform/upgrade_transforms.rb, line 45 def upgrade_transforms(arguments = {}) request_opts = { endpoint: arguments[:endpoint] || 'transform.upgrade_transforms' } arguments = arguments.clone headers = arguments.delete(:headers) || {} body = nil method = Elasticsearch::API::HTTP_POST path = '_transform/_upgrade' params = Utils.process_params(arguments) Elasticsearch::API::Response.new( perform_request(method, path, params, body, headers, request_opts) ) end
Upgrade all transforms. Transforms are compatible across minor versions and between supported major versions. However, over time, the format of transform configuration information may change. This API
identifies transforms that have a legacy configuration format and upgrades them to the latest version. It also cleans up the internal data structures that store the transform state and checkpoints. The upgrade does not affect the source and destination indices. The upgrade also does not affect the roles that transforms use when Elasticsearch
security features are enabled; the role used to read source data and write to the destination index remains unchanged. If a transform upgrade step fails, the upgrade stops and an error is returned about the underlying issue. Resolve the issue then re-run the process again. A summary is returned when the upgrade is finished. To ensure continuous transforms remain running during a major version upgrade of the cluster – for example, from 7.16 to 8.0 – it is recommended to upgrade transforms before upgrading the cluster. You may want to perform a recent cluster backup prior to the upgrade.
@option arguments [Boolean] :dry_run When true, the request checks for updates but does not run them. @option arguments [Time] :timeout Period to wait for a response. If no response is received before the timeout expires, the request fails and
returns an error. Server default: 30s.
@option arguments [Hash] :headers Custom HTTP headers
@see www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-transform-upgrade-transforms