module Elasticsearch::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/8.16/ilm-delete-lifecycle.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb, line 32
def delete_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.delete_lifecycle' }

  defined_params = [:policy].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 'policy' missing" unless arguments[:policy]

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

  body = nil

  _policy = arguments.delete(:policy)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-explain-lifecycle.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb, line 34
def explain_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.explain_lifecycle' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body   = nil

  _index = arguments.delete(:index)

  method = Elasticsearch::API::HTTP_GET
  path   = "#{Utils.__listify(_index)}/_ilm/explain"
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-get-lifecycle.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb, line 32
def get_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.get_lifecycle' }

  defined_params = [:policy].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

  _policy = arguments.delete(:policy)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-get-status.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/get_status.rb, line 31
def get_status(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.get_status' }

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

  body   = nil

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-migrate-to-data-tiers.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/migrate_to_data_tiers.rb, line 33
def migrate_to_data_tiers(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.migrate_to_data_tiers' }

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

  body   = arguments.delete(:body)

  method = Elasticsearch::API::HTTP_POST
  path   = '_ilm/migrate_to_data_tiers'
  params = Utils.process_params(arguments)

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-move-to-step.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/move_to_step.rb, line 33
def move_to_step(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.move_to_step' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body   = arguments.delete(:body)

  _index = arguments.delete(:index)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-put-lifecycle.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb, line 33
def put_lifecycle(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.put_lifecycle' }

  defined_params = [:policy].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 'policy' missing" unless arguments[:policy]

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

  body = arguments.delete(:body)

  _policy = arguments.delete(:policy)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-remove-policy.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/remove_policy.rb, line 32
def remove_policy(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.remove_policy' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body   = nil

  _index = arguments.delete(:index)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-retry-policy.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/retry.rb, line 32
def retry(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.retry' }

  defined_params = [:index].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 'index' missing" unless arguments[:index]

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

  body   = nil

  _index = arguments.delete(:index)

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-start.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/start.rb, line 31
def start(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.start' }

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

  body   = nil

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
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/8.16/ilm-stop.html

# File lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb, line 31
def stop(arguments = {})
  request_opts = { endpoint: arguments[:endpoint] || 'ilm.stop' }

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

  body   = nil

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

  Elasticsearch::API::Response.new(
    perform_request(method, path, params, body, headers, request_opts)
  )
end