# Action delete with timeout in ISM

**URL:** https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906
**Category:** Index Management
**Created:** [September 2, 2021, 2:09am UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906 "2021-09-02T02:09:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)
#### Post date: [September 2, 2021, 2:09am UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/1 "2021-09-02T02:09:15Z")

</div>

Hi, I just begin using ISM to auto-delete old indices.

My policy

```auto
{
    "policy_id": "delete_old_index_25d",
    "description": "Delete old index older than 25 days.",
    "last_updated_time": 1630510660300,
    "schema_version": 1,
    "error_notification": null,
    "default_state": "open",
    "states": [
        {
            "name": "open",
            "actions": [],
            "transitions": [
                {
                    "state_name": "delete",
                    "conditions": {
                        "min_index_age": "25d"
                    }
                }
            ]
        },
        {
            "name": "delete",
            "actions": [
                {
                    "delete": {}
                }
            ],
            "transitions": []
        }
    ],
    "ism_template": {
        "index_patterns": [
            "my-index-name-*"
        ],
        "priority": 100,
        "last_updated_time": 1630510660300
    }
}

```

I checked the job result and it was

```auto
    "cause": "failed to process cluster event (delete-index [[my-index-name-2021.08.06/YMF7yT0WTY614TpzBDYSxw]]) within 30s",

```

My daily index is heavy, it is about almost 3Tb. So whenever I have to delete it, I always put a timeout param for it. Like:

```auto
DELETE my-index-name?timeout=60s

```

But how I can do it in ISM?

---

<div class="post-metadata">

### Author: ![searchymcsearchface](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/searchymcsearchface/32/868_2.png) [@searchymcsearchface](https://forum.opensearch.org/u/searchymcsearchface)
#### Post date: [September 2, 2021, 1:12pm UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/2 "2021-09-02T13:12:23Z")

</div>

I haven’t tested this but can you use `timeout` as described in the [documentation](https://opensearch.org/docs/im-plugin/ism/policies/#actions)?

---

<div class="post-metadata">

### Author: ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)
#### Post date: [September 2, 2021, 1:34pm UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/3 "2021-09-02T13:34:56Z")

</div>

LOL. Why I don’t think about that 😂😂😂 . Lets me try and will lets you know the result 😁  
I thought timeout would affect in another way in document 😃

```auto
        {
            "name": "delete",
            "actions": [
                {
                    "timeout": "1h",
                    "delete": {}
                }
            ],
            "transitions": []
        }

```

---

<div class="post-metadata">

### Author: ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)
#### Post date: [September 4, 2021, 6:22pm UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/4 "2021-09-04T18:22:06Z")

</div>

Everything working well, no timeout or failed job so far on delete 😃

---

<div class="post-metadata">

### Author: ![searchymcsearchface](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/searchymcsearchface/32/868_2.png) [@searchymcsearchface](https://forum.opensearch.org/u/searchymcsearchface)
#### Post date: [September 7, 2021, 2:40pm UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/5 "2021-09-07T14:40:57Z")

</div>

Glad it’s working for you!

Semi-related - there is an enhancement currently in the discussion stage about how action settings are handled. Maybe you have some feedback?

[https://github.com/opensearch-project/index-management/issues/135](https://github.com/opensearch-project/index-management/issues/135)

---

<div class="post-metadata">

### Author: ![dbbaughe](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@dbbaughe](https://forum.opensearch.org/u/dbbaughe)
#### Post date: [September 7, 2021, 5:49pm UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/6 "2021-09-07T17:49:52Z")

</div>

Hrmm that timeout shouldn’t be doing what you want @BlackMetalz (adding a timeout to the delete operation API). It instead is a timeout for the action (if the action started and isn’t able to complete within this amount of time).

We don’t currently support modifying the generic parameters of the API calls like timeouts. And a delete call isn’t exactly going and deleting all the data before it treats it as successful, it’s adding an URGENT priority task into the queue on the master node to flag the index as deleted and cleans it up in the background. If deletes are routinely failing because of the 30s timeout then I’d take a look at your cluster to see what is potentially going on, i.e. is your pending tasks getting backed up or master overloaded and can’t process the tasks quick enough, etc.

---

<div class="post-metadata">

### Author: ![BlackMetalz](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BlackMetalz](https://forum.opensearch.org/u/BlackMetalz)
#### Post date: [September 8, 2021, 3:55am UTC](https://forum.opensearch.org/t/action-delete-with-timeout-in-ism/6906/7 "2021-09-08T03:55:26Z")

</div>

Mostly cluster isn’t having much load at that time I did delete, but the point is deleting a lot of data, like 12-16Tb per query delete `DELETE index-2021-08*`. That gave timeout for me, but delete a single index as I mention above is about 2-3Tb it doesn’t give a timeout And seem like delete with ism only appear first time since they have to delete a lot of data, after that only 1 index is being get deleted xD
