﻿---
title: Manually apply a lifecycle policy to an index
description: When you create a new Elasticsearch index, it automatically picks up settings, mappings, and aliases from any matching index template and its component...
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/manage-data/lifecycle/index-lifecycle-management/policy-apply
products:
  - Elasticsearch
---

# Manually apply a lifecycle policy to an index
When you create a new Elasticsearch index, it automatically picks up settings, mappings, and aliases from any matching [index template](/elastic/docs-content/pull/3898/manage-data/data-store/templates#index-templates) and its component templates. If the template specifies a lifecycle policy, that policy is applied to the new index as soon as it's created so that the index will be managed by ILM. This process is described in detail in [Configure a lifecycle policy](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy).
You can also apply a lifecycle policy manually to existing indices that are not yet managed, as described on this page. This is useful if you want to:
- Configure the indices to move through different [data tiers](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/manage-data/lifecycle/data-tiers) as they age.
- Perform [lifecycle actions](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/tree/main/reference/elasticsearch/index-lifecycle-actions) such as downsampling or shrinking.
- Delete the indices when they reach a certain age.

<warning>
  Consider the following before manually applying a policy to an index:
  - If an index is currently managed by an ILM policy you must first remove that policy before applying a new one. To remove or make changes to an ILM policy currently applied to one or more indices, or to switch indices to use a different policy, refer to [Update or switch a lifecycle policy](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/manage-data/lifecycle/index-lifecycle-management/policy-updates).
  - Do not manually apply a policy that uses the rollover action. Policies that use rollover must be applied by the [index template](/elastic/docs-content/pull/3898/manage-data/lifecycle/index-lifecycle-management/configure-lifecycle-policy#apply-policy-template). Otherwise, the policy is not carried forward when the rollover action creates a new index. For an approach to migrating existing indices that supports rollover, refer to [Migrate to ILM](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/manage-data/lifecycle/index-lifecycle-management/migrate-ilm).
</warning>

You can do this procedure in Kibana or using the Elasticsearch API.
<tab-set>
  <tab-item title="Kibana">
    To apply a lifecycle policy to an existing index:
    1. Go to the **Index Management** page using the navigation menu or the [global search field](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/3898/explore-analyze/find-and-organize/find-apps-and-objects).
    2. In the **Indices** tab, search for and select an index. Enable **Include hidden indices** to see the full list of indices.
    3. From the **Manage index** dropdown menu select **Add lifecycle policy**.
    4. Choose a lifecycle policy and confirm your changes.
  </tab-item>

  <tab-item title="API">
    Use the [update settings API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-settings) to apply a lifecycle policy to an index.
    ```json

    {
      "index": {
        "lifecycle": {
          "name": "my_ilm_policy"
        }
      }
    }
    ```
    You can apply the same policy to multiple indices by using wildcards in the index name when you call the API.
    ```json

    {
      "index": {
        "lifecycle": {
          "name": "my_ilm_policy"
        }
      }
    }
    ```

    <warning>
      Be careful not to inadvertently match indices that you don’t want to modify.
    </warning>
  </tab-item>
</tab-set>

Once the policy is applied, ILM starts managing the index immediately.