module Elasticsearch::XPack::API::IndexLifecycleManagement::Actions

Public Instance Methods

delete_lifecycle(arguments = {}) click to toggle source

Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted.

@option arguments [String] :policy The name of the index lifecycle policy @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-delete-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_lifecycle.rb, line 30
def delete_lifecycle(arguments = {})
  raise ArgumentError, "Required argument 'policy' missing" unless arguments[:policy]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _policy = arguments.delete(:policy)

  method = Elasticsearch::API::HTTP_DELETE
  path   = "_ilm/policy/#{Elasticsearch::API::Utils.__listify(_policy)}"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
delete_policy(arguments = {}) click to toggle source

Deletes a lifecycle policy

@option arguments [String] :policy_id Identifier for the policy @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node @option arguments [Time] :timeout Specifies the period of time to wait for a response.

@see www.elastic.co/guide/en/elasticsearch/reference/current/ilm-delete-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_policy.rb, line 31
def delete_policy(arguments = {})
  raise ArgumentError, "Required argument 'policy_id' missing" unless arguments[:policy_id]

  method = Elasticsearch::API::HTTP_DELETE
  path   = Elasticsearch::API::Utils.__pathify "_ilm/policy",
                                               Elasticsearch::API::Utils.__escape(arguments[:policy_id])
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

  perform_request(method, path, params, body).body
end
explain(arguments = {}) click to toggle source

Shows an index’s current lifecycle status

@option arguments [String] :index The target index (Required) @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node @option arguments [Time] :timeout Specifies the period of time to wait for a response.

@see www.elastic.co/guide/en/elasticsearch/reference/current/ilm-explain-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain.rb, line 31
def explain(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))

  method = Elasticsearch::API::HTTP_GET
  path   = Elasticsearch::API::Utils.__pathify index, "_ilm/explain"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

  perform_request(method, path, params, body).body
end
explain_lifecycle(arguments = {}) click to toggle source

Retrieves information about the index's current lifecycle state, such as the currently executing phase, action, and step.

@option arguments [String] :index The name of the index to explain @option arguments [Boolean] :only_managed filters the indices included in the response to ones managed by ILM @option arguments [Boolean] :only_errors filters the indices included in the response to ones in an ILM error state, implies only_managed @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-explain-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain_lifecycle.rb, line 32
def explain_lifecycle(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_ilm/explain"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_lifecycle(arguments = {}) click to toggle source

Returns the specified policy definition. Includes the policy version and last modified date.

@option arguments [String] :policy The name of the index lifecycle policy @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-get-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_lifecycle.rb, line 30
def get_lifecycle(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _policy = arguments.delete(:policy)

  method = Elasticsearch::API::HTTP_GET
  path   = if _policy
             "_ilm/policy/#{Elasticsearch::API::Utils.__listify(_policy)}"
           else
             "_ilm/policy"
           end
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
get_policy(arguments = {}) click to toggle source

Retrieves a lifecycle policy

@option arguments [String] :policy_id Identifier for the policy @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node @option arguments [Time] :timeout Specifies the period of time to wait for a response.

@see www.elastic.co/guide/en/elasticsearch/reference/current/ilm-get-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_policy.rb, line 31
def get_policy(arguments = {})
  method = Elasticsearch::API::HTTP_GET
  path   = Elasticsearch::API::Utils.__pathify "_ilm/policy",
                                               Elasticsearch::API::Utils.__escape(arguments[:policy_id])
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

  perform_request(method, path, params, body).body
end
get_status(arguments = {}) click to toggle source

Retrieves the current index lifecycle management (ILM) status.

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-get-status.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_status.rb, line 29
def get_status(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_GET
  path   = "_ilm/status"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
migrate_to_data_tiers(arguments = {}) click to toggle source

Migrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing

@option arguments [Boolean] :dry_run If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to “data”)

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-migrate-to-data-tiers.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/migrate_to_data_tiers.rb, line 31
def migrate_to_data_tiers(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_ilm/migrate_to_data_tiers"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
move_to_step(arguments = {}) click to toggle source

Manually moves an index into the specified step and executes that step.

@option arguments [String] :index The name of the index whose lifecycle step is to change @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The new lifecycle step to move to

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-move-to-step.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/move_to_step.rb, line 31
def move_to_step(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "_ilm/move/#{Elasticsearch::API::Utils.__listify(_index)}"
  params = {}

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
put_lifecycle(arguments = {}) click to toggle source

Creates a lifecycle policy

@option arguments [String] :policy The name of the index lifecycle policy @option arguments [Hash] :headers Custom HTTP headers @option arguments [Hash] :body The lifecycle policy definition to register

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-put-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_lifecycle.rb, line 31
def put_lifecycle(arguments = {})
  raise ArgumentError, "Required argument 'policy' missing" unless arguments[:policy]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _policy = arguments.delete(:policy)

  method = Elasticsearch::API::HTTP_PUT
  path   = "_ilm/policy/#{Elasticsearch::API::Utils.__listify(_policy)}"
  params = {}

  body = arguments[:body]
  perform_request(method, path, params, body, headers).body
end
put_policy(arguments = {}) click to toggle source

Register a new watch in or update an existing one

@option arguments [String] :policy_id Identifier for the policy (Required) @option arguments [Hash] :body The policy (Required) @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node @option arguments [Time] :timeout Specifies the period of time to wait for a response.

@see www.elastic.co/guide/en/elasticsearch/reference/current/ilm-put-lifecycle.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_policy.rb, line 32
def put_policy(arguments = {})
  raise ArgumentError, "Required argument 'policy_id' missing" unless arguments[:policy_id]
  raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

  method = Elasticsearch::API::HTTP_PUT
  path   = Elasticsearch::API::Utils.__pathify "_ilm/policy",
                                               Elasticsearch::API::Utils.__escape(arguments[:policy_id])
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = arguments[:body]

  perform_request(method, path, params, body).body
end
remove_policy(arguments = {}) click to toggle source

Removes the assigned lifecycle policy and stops managing the specified index

@option arguments [String] :index The name of the index to remove policy on @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-remove-policy.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/remove_policy.rb, line 30
def remove_policy(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_ilm/remove"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
retry(arguments = {}) click to toggle source

Retries executing the policy for an index that is in the ERROR step.

@option arguments [String] :index The name of the indices (comma-separated) whose failed lifecycle step is to be retry @option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-retry-policy.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry.rb, line 30
def retry(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_POST
  path   = "#{Elasticsearch::API::Utils.__listify(_index)}/_ilm/retry"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
retry_policy(arguments = {}) click to toggle source

Retry executing the policy for an index that is in the ERROR step

@option arguments [String] :index The target index (Required) @option arguments [Time] :master_timeout Specifies the period of time to wait for a connection to the master node @option arguments [Time] :timeout Specifies the period of time to wait for a response.

@see www.elastic.co/guide/en/elasticsearch/reference/current/ilm-move-to-step.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry_policy.rb, line 31
def retry_policy(arguments = {})
  raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]

  method = Elasticsearch::API::HTTP_POST
  index = Elasticsearch::API::Utils.__escape(arguments.delete(:index))
  path = Elasticsearch::API::Utils.__pathify index, "_ilm/retry"
  params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
  body   = nil

  perform_request(method, path, params, body).body
end
start(arguments = {}) click to toggle source

Start the index lifecycle management (ILM) plugin.

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-start.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/start.rb, line 29
def start(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_ilm/start"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end
stop(arguments = {}) click to toggle source

Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin

@option arguments [Hash] :headers Custom HTTP headers

@see www.elastic.co/guide/en/elasticsearch/reference/7.14/ilm-stop.html

# File lib/elasticsearch/xpack/api/actions/index_lifecycle_management/stop.rb, line 29
def stop(arguments = {})
  headers = arguments.delete(:headers) || {}

  arguments = arguments.clone

  method = Elasticsearch::API::HTTP_POST
  path   = "_ilm/stop"
  params = {}

  body = nil
  perform_request(method, path, params, body, headers).body
end