# Delete unused templates

**URL:** <https://discuss.elastic.co/t/delete-unused-templates/224198>\
**Category:** Elasticsearch\
**Created:** [March 18, 2020, 10:46pm UTC](https://discuss.elastic.co/t/delete-unused-templates/224198 "2020-03-18T22:46:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashokm](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@ashokm](https://discuss.elastic.co/u/ashokm)\
**Post date:** [March 18, 2020, 10:46pm UTC](https://discuss.elastic.co/t/delete-unused-templates/224198/1 "2020-03-18T22:46:07Z")

</div>

We are on ES version 6.8.0. Due to an issue in our software, we ended up having 30k unused templates on a 3 node cluster. Deleting these one by one is really slow like each one is taking upto 2 minutes and some are timing out after 2 minutes. Any easy way to delete these unused templates? I tried a wild card delete and that doesn't seem to work and timeout as well.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 18, 2020, 11:51pm UTC](https://discuss.elastic.co/t/delete-unused-templates/224198/2 "2020-03-18T23:51:19Z")

</div>

Oh wow, that's pretty huge. It's likely timing out due to cluster state updates being slow, but I don't know of an easy fix here.

Someone else will hopefully pop in with some better advice!

---

<div class="post-metadata">

**Author:** ![ashokm](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@ashokm](https://discuss.elastic.co/u/ashokm)\
**Post date:** [March 19, 2020, 12:02am UTC](https://discuss.elastic.co/t/delete-unused-templates/224198/3 "2020-03-19T00:02:21Z")

</div>

Thanks Mark. I am hoping, there is some workaround out there. If not, I may have to look at spinning a new cluster and moving to that instead.

---

<div class="post-metadata">

**Author:** ![scottdfedorov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/scottdfedorov/32/64699_2.png) [@scottdfedorov](https://discuss.elastic.co/u/scottdfedorov)\
**Post date:** [March 19, 2020, 1:42am UTC](https://discuss.elastic.co/t/delete-unused-templates/224198/4 "2020-03-19T01:42:50Z")

</div>

> [@ashokm](#):
>
> cluster. Deleting these one by one is really slow like each one is taking upto 2 minutes and some are timing out after 2 minutes. Any easy way to delete these unused templates? I tried a wild card delete and that doesn't seem to work and timeout as well.
> 
> Thanks in advance

Safe to assume you adjusted the timeout parameters on the request to be longer?  
I don't have anything good to add here, but based on what Mark said, and the fact that you have a small cluster, perhaps you can reduce the shards/replicas, shrink your cluster to a single node, then run it... maybe that would speed it up?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2020, 1:54am UTC](https://discuss.elastic.co/t/delete-unused-templates/224198/5 "2020-04-16T01:54:00Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
