---
type: api
title: Migrate Elasticsearch resource to use ILM
description: Migrates the specified Elasticsearch resource to use ILM.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-enable-deployment-resource-ilm
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/operation/operation-enable-deployment-resource-ilm
products:
  - Elastic Cloud Enterprise
---

# Migrate Elasticsearch resource to use ILM

## Paths

- `POST` `/deployments/{deployment_id}/elasticsearch/{ref_id}/_enable-ilm`

- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#basicauth)
- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/cloud-enterprise/v4/authentication#apikey)

#### Path Parameters

- `deployment_id` (string)
  Identifier for the Deployment.
- `ref_id` (string)
  User-specified RefId for the Resource (or '_main' if there is only one).

## Description

Migrates the specified Elasticsearch resource to use ILM.

## Query String Parameters

- `validate_only` (boolean · default: false)
  When `true`, does not enable ILM but returns warnings if any applications may lose availability during ILM migration.

## Request Body

`application/json`

Information to build the ILM policies that will be created

- `index_patterns` ([] IndexPattern) — required
  A locally-unique user-specified id for Kibana
  - `index_pattern` (string) — required
    Index pattern to which the ILM policy will be applied.
  - `policy_name` (string) — required
    Name of the policy to create
  - `node_attributes` (map string to string) — optional
    Defines the Elasticsearch node attributes for the warm element of the topology

## Responses

#### `200`

Standard response

`application/json`

- `warnings` ([] ReplyWarning)
  List of warnings generated from validating command
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the warning that occurred
#### `404`

* The Deployment specified by {deployment_id} cannot be found. (code: `deployments.deployment_not_found`)
* The Resource specified by {ref_id} cannot be found. (code: `deployments.deployment_resource_not_found`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `500`

We have failed you. (code: `deployments.deployment_resource_no_longer_exists`)

`application/json`

- `errors` ([] BasicFailedReplyElement)
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` ([] string)
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response Headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code Examples

#### Console

```console
POST /deployments/{deployment_id}/elasticsearch/{ref_id}/_enable-ilm
```

#### curl

```curl
curl -X POST "/deployments/{deployment_id}/elasticsearch/{ref_id}/_enable-ilm"
```

