[[reference-ilm]]
== client.ilm

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////
++++
<style>
.lang-ts a.xref {
  text-decoration: underline !important;
}
</style>
++++


[discrete]
[[client.ilm.deleteLifecycle]]
== `client.ilm.deleteLifecycle()`

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.

{ref}/ilm-delete-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmDeleteLifecycleRequest, options?: TransportRequestOptions) => Promise<IlmDeleteLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmDeleteLifecycleRequest extends <<RequestBase>> {
  name: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmDeleteLifecycleResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.ilm.explainLifecycle]]
== `client.ilm.explainLifecycle()`

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.

{ref}/ilm-explain-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmExplainLifecycleRequest, options?: TransportRequestOptions) => Promise<IlmExplainLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmExplainLifecycleRequest extends <<RequestBase>> {
  index: <<IndexName>>
  only_errors?: boolean
  only_managed?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IlmExplainLifecycleResponse {
  indices: Record<<<IndexName>>, IlmExplainLifecycleLifecycleExplain>
}

----


[discrete]
[[client.ilm.getLifecycle]]
== `client.ilm.getLifecycle()`

Retrieves a lifecycle policy.

{ref}/ilm-get-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmGetLifecycleRequest, options?: TransportRequestOptions) => Promise<IlmGetLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmGetLifecycleRequest extends <<RequestBase>> {
  name?: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmGetLifecycleResponse = Record<string, IlmGetLifecycleLifecycle>

----


[discrete]
[[client.ilm.getStatus]]
== `client.ilm.getStatus()`

Retrieves the current index lifecycle management (ILM) status.

{ref}/ilm-get-status.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmGetStatusRequest, options?: TransportRequestOptions) => Promise<IlmGetStatusResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmGetStatusRequest extends <<RequestBase>> {}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IlmGetStatusResponse {
  operation_mode: <<LifecycleOperationMode>>
}

----


[discrete]
[[client.ilm.migrateToDataTiers]]
== `client.ilm.migrateToDataTiers()`

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.

{ref}/ilm-migrate-to-data-tiers.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmMigrateToDataTiersRequest, options?: TransportRequestOptions) => Promise<IlmMigrateToDataTiersResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmMigrateToDataTiersRequest extends <<RequestBase>> {
  dry_run?: boolean
  legacy_template_to_delete?: string
  node_attribute?: string
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IlmMigrateToDataTiersResponse {
  dry_run: boolean
  removed_legacy_template: string
  migrated_ilm_policies: string[]
  migrated_indices: <<Indices>>
  migrated_legacy_templates: string[]
  migrated_composable_templates: string[]
  migrated_component_templates: string[]
}

----


[discrete]
[[client.ilm.moveToStep]]
== `client.ilm.moveToStep()`

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

{ref}/ilm-move-to-step.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmMoveToStepRequest, options?: TransportRequestOptions) => Promise<IlmMoveToStepResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmMoveToStepRequest extends <<RequestBase>> {
  index: <<IndexName>>
  current_step: IlmMoveToStepStepKey
  next_step: IlmMoveToStepStepKey
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmMoveToStepResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.ilm.putLifecycle]]
== `client.ilm.putLifecycle()`

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

{ref}/ilm-put-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmPutLifecycleRequest, options?: TransportRequestOptions) => Promise<IlmPutLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmPutLifecycleRequest extends <<RequestBase>> {
  name: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  policy?: <<IlmPolicy>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmPutLifecycleResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.ilm.removePolicy]]
== `client.ilm.removePolicy()`

Removes the assigned lifecycle policy and stops managing the specified index

{ref}/ilm-remove-policy.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmRemovePolicyRequest, options?: TransportRequestOptions) => Promise<IlmRemovePolicyResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmRemovePolicyRequest extends <<RequestBase>> {
  index: <<IndexName>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IlmRemovePolicyResponse {
  failed_indexes: <<IndexName>>[]
  has_failures: boolean
}

----


[discrete]
[[client.ilm.retry]]
== `client.ilm.retry()`

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

{ref}/ilm-retry-policy.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmRetryRequest, options?: TransportRequestOptions) => Promise<IlmRetryResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmRetryRequest extends <<RequestBase>> {
  index: <<IndexName>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmRetryResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.ilm.start]]
== `client.ilm.start()`

Start the index lifecycle management (ILM) plugin.

{ref}/ilm-start.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmStartRequest, options?: TransportRequestOptions) => Promise<IlmStartResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmStartRequest extends <<RequestBase>> {
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmStartResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.ilm.stop]]
== `client.ilm.stop()`

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

{ref}/ilm-stop.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IlmStopRequest, options?: TransportRequestOptions) => Promise<IlmStopResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IlmStopRequest extends <<RequestBase>> {
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IlmStopResponse = <<AcknowledgedResponseBase>>

----


