# Cat indices API get 0 doc count index

**URL:** <https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769>\
**Category:** Elasticsearch\
**Created:** [September 3, 2019, 6:57am UTC](https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769 "2019-09-03T06:57:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pd\_tester](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@pd\_tester](https://discuss.elastic.co/u/pd_tester)\
**Post date:** [September 3, 2019, 6:57am UTC](https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769/1 "2019-09-03T06:57:55Z")

</div>

Hi everyone,

Is it possible to have one ES call for retrieving indices with zero doc count?  
Scenario is we want to delete all indices with zero doc count.  
Is this possible in one go?

Thank you

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 3, 2019, 7:59am UTC](https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769/2 "2019-09-03T07:59:10Z")

</div>

In only one request, I don't think you can but it should be easy to automate this using the `_cat/indices` API.

The question to me is more: why do you create indices if you don't send documents? Could you just use index templates and when a first document is sent the index is automatically created. If no document is sent, no index will be created.

---

<div class="post-metadata">

**Author:** ![pd\_tester](https://avatars.discourse-cdn.com/v4/letter/p/a9adbd/32.png) [@pd\_tester](https://discuss.elastic.co/u/pd_tester)\
**Post date:** [September 3, 2019, 11:02am UTC](https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769/3 "2019-09-03T11:02:25Z")

</div>

Thank you for this one David.

---

<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:** [October 1, 2019, 11:02am UTC](https://discuss.elastic.co/t/cat-indices-api-get-0-doc-count-index/197769/4 "2019-10-01T11:02:36Z")

</div>

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