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. A currently used policy cannot be deleted.

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

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

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | 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 (Literal[-1] | ~typing.Literal[0] | str | 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.

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/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 (Literal[-1] | ~typing.Literal[0] | str | 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 (Literal[-1] | ~typing.Literal[0] | str | 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)

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

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

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

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | 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 (Literal[-1] | ~typing.Literal[0] | str | 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.13/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)

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

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/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, error_trace=None, filter_path=None, human=None, next_step=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.13/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

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

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

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | 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 (Literal[-1] | ~typing.Literal[0] | str | 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.13/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.13/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.13/ilm-start.html

Parameters:
  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

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.13/ilm-stop.html

Parameters:
  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]