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

Included in:
IndexLifecycleManagementClient
Defined in:
lib/elasticsearch/xpack/api/namespace/index_lifecycle_management.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/stop.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/start.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_policy.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_status.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_policy.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/move_to_step.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/retry_policy.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_policy.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/get_lifecycle.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/put_lifecycle.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/remove_policy.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/params_registry.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/delete_lifecycle.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/explain_lifecycle.rb,
lib/elasticsearch/xpack/api/actions/index_lifecycle_management/migrate_to_data_tiers.rb

Defined Under Namespace

Modules: ParamsRegistry

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:



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

Deletes a lifecycle policy

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    Identifier for the policy

  • :master_timeout (Time)

    Specifies the period of time to wait for a connection to the master node

  • :timeout (Time)

    Specifies the period of time to wait for a response.

Raises:

  • (ArgumentError)

See Also:



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

Shows an index’s current lifecycle status

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :index (String)

    The target index (Required)

  • :master_timeout (Time)

    Specifies the period of time to wait for a connection to the master node

  • :timeout (Time)

    Specifies the period of time to wait for a response.

Raises:

  • (ArgumentError)

See Also:



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



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



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

Retrieves a lifecycle policy

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    Identifier for the policy

  • :master_timeout (Time)

    Specifies the period of time to wait for a connection to the master node

  • :timeout (Time)

    Specifies the period of time to wait for a response.

See Also:



31
32
33
34
35
36
37
38
39
# 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 = {}) ⇒ 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:



29
30
31
32
33
34
35
36
37
38
39
40
# 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 = {}) ⇒ 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:



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



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



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

Register a new watch in or update an existing one

Parameters:

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

    a customizable set of options

Options Hash (arguments):

  • :policy_id (String)

    Identifier for the policy (Required)

  • :body (Hash)

    The policy (Required)

  • :master_timeout (Time)

    Specifies the period of time to wait for a connection to the master node

  • :timeout (Time)

    Specifies the period of time to wait for a response.

Raises:

  • (ArgumentError)

See Also:



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



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



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

Retry 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 target index (Required)

  • :master_timeout (Time)

    Specifies the period of time to wait for a connection to the master node

  • :timeout (Time)

    Specifies the period of time to wait for a response.

Raises:

  • (ArgumentError)

See Also:



31
32
33
34
35
36
37
38
39
40
41
# 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 = {}) ⇒ 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:



29
30
31
32
33
34
35
36
37
38
39
40
# 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 = {}) ⇒ 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:



29
30
31
32
33
34
35
36
37
38
39
40
# 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