Index Lifecycle Management (ILM)

class elasticsearch.client.IlmClient(client)
Parameters:

client (BaseClient)

delete_lifecycle(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes the specified lifecycle policy definition. You cannot delete policies that are currently in use. If the policy is being used to manage any indices, the request fails and returns an error.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-delete-lifecycle.html

Parameters:
  • name (str) – Identifier for the policy.

  • master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

explain_lifecycle(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, only_errors=None, only_managed=None, pretty=None, timeout=None)

Retrieves information about the index’s current lifecycle state, such as the currently executing phase, action, and step. Shows when the index entered each one, the definition of the running phase, and information about any failures.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-explain-lifecycle.html

Parameters:
  • index (str) – Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (*). To target all data streams and indices, use * or _all.

  • master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • only_errors (bool | None) – Filters the returned indices to only indices that are managed by ILM and are in an error state, either due to an encountering an error while executing the policy, or attempting to use a policy that does not exist.

  • only_managed (bool | None) – Filters the returned indices to only indices that are managed by ILM.

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_lifecycle(*, name=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Retrieves a lifecycle policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-get-lifecycle.html

Parameters:
  • name (str | None) – Identifier for the policy.

  • master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the current index lifecycle management (ILM) status.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-get-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

migrate_to_data_tiers(*, dry_run=None, error_trace=None, filter_path=None, human=None, legacy_template_to_delete=None, node_attribute=None, pretty=None, body=None)

Switches the indices, ILM policies, and legacy, composable and component templates from using custom node attributes and attribute-based allocation filters to using data tiers, and optionally deletes one legacy index template.+ Using node roles enables ILM to automatically move the indices between data tiers.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-migrate-to-data-tiers.html

Parameters:
  • dry_run (bool | None) – If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be migrated.

  • legacy_template_to_delete (str | None)

  • node_attribute (str | None)

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

move_to_step(*, index, current_step=None, next_step=None, error_trace=None, filter_path=None, human=None, pretty=None, body=None)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-move-to-step.html

Parameters:
Return type:

ObjectApiResponse[Any]

put_lifecycle(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, policy=None, pretty=None, timeout=None, body=None)

Creates a lifecycle policy. If the specified policy exists, the policy is replaced and the policy version is incremented.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-put-lifecycle.html

Parameters:
  • name (str) – Identifier for the policy.

  • master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • policy (Mapping[str, Any] | None)

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

remove_policy(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Removes the assigned lifecycle policy and stops managing the specified index

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-remove-policy.html

Parameters:
  • index (str) – The name of the index to remove policy on

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

retry(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-retry-policy.html

Parameters:
  • index (str) – The name of the indices (comma-separated) whose failed lifecycle step is to be retry

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

start(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Start the index lifecycle management (ILM) plugin.

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-start.html

Parameters:
Return type:

ObjectApiResponse[Any]

stop(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.16/ilm-stop.html

Parameters:
Return type:

ObjectApiResponse[Any]