Module: Elasticsearch::API::IndexLifecycleManagement::Actions

Included in:
IndexLifecycleManagementClient
Defined in:
lib/elasticsearch/api/namespace/index_lifecycle_management.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/stop.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/retry.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/start.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/get_status.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/move_to_step.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/get_lifecycle.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/put_lifecycle.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/remove_policy.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/delete_lifecycle.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/explain_lifecycle.rb,
lib/elasticsearch/api/actions/index_lifecycle_management/migrate_to_data_tiers.rb

Instance Method Summary collapse

Instance Method Details

#delete_lifecycle(arguments = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :policy (String)

    The name of the index lifecycle policy

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index to explain

  • :only_managed (Boolean)

    filters the indices included in the response to ones managed by ILM

  • :only_errors (Boolean)

    filters the indices included in the response to ones in an ILM error state, implies only_managed

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :policy (String)

    The name of the index lifecycle policy

  • :headers (Hash)

    Custom HTTP headers

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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 = {}) ⇒ Object

Retrieves the current index lifecycle management (ILM) status.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :dry_run (Boolean)

    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

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    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 Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index whose lifecycle step is to change

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The new lifecycle step to move to

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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 = {}) ⇒ Object

Creates a lifecycle policy

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :policy (String)

    The name of the index lifecycle policy

  • :headers (Hash)

    Custom HTTP headers

  • :body (Hash)

    The lifecycle policy definition to register

Raises:

  • (ArgumentError)

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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 = {}) ⇒ Object

Removes the assigned lifecycle policy and stops managing the specified index

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the index to remove policy on

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The name of the indices (comma-separated) whose failed lifecycle step is to be retry

  • :headers (Hash)

    Custom HTTP headers

Raises:

  • (ArgumentError)

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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 = {}) ⇒ Object

Start the index lifecycle management (ILM) plugin.

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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 = {}) ⇒ Object

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

Parameters:

  • arguments (Hash) (defaults to: {})

    a customizable set of options

Options Hash (arguments):

  • :headers (Hash)

    Custom HTTP headers

See Also:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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