# How can I get the count of all indices?

**URL:** <https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047>\
**Category:** Elasticsearch\
**Created:** [October 30, 2021, 2:55am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047 "2021-10-30T02:55:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://discuss.elastic.co/u/buaaytt)\
**Post date:** [October 30, 2021, 2:55am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/1 "2021-10-30T02:55:32Z")

</div>

And is there a way to configure whether to include the default system indices, whose names start with a dot?

---

<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:** [October 30, 2021, 3:49am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/2 "2021-10-30T03:49:10Z")

</div>

Welcome!

You can use the \_cat API.

Something like:

```
curl localhost:9200/_cat/indices | wc -l

```

You can try something like:

```
curl localhost:9200/_cat/indices/*,-.* | wc -l

```

Not tested but I think it should exclude indices starting with a dot.

---

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://discuss.elastic.co/u/buaaytt)\
**Post date:** [October 30, 2021, 1:02pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/3 "2021-10-30T13:02:59Z")

</div>

Got something like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/c/8c721e0124d052efde915ec9eb82901b11522109.png)

Doesn't look like it has the index count value though.

---

<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:** [October 31, 2021, 7:31am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/4 "2021-10-31T07:31:54Z")

</div>

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with `</>` icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

Here, I think the number of indices is 9, right?

---

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://discuss.elastic.co/u/buaaytt)\
**Post date:** [October 31, 2021, 1:50pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/5 "2021-10-31T13:50:07Z")

</div>

I don't see an 'Edit' link to any of my existing post.

---

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://discuss.elastic.co/u/buaaytt)\
**Post date:** [October 31, 2021, 1:52pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/6 "2021-10-31T13:52:26Z")

</div>

Seems like correct. But what does the `*,-.*` mean in the second command? The first command seems to list all indices, including the system ones, while the second to list the ones that I created. But what's the meaning of those symbols in the path? Any document?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 31, 2021, 3:10pm UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/7 "2021-10-31T15:10:14Z")

</div>

It means

`*` (All the indices)`, -.*` (But not the indices that start with `.` Which are system indices)

---

<div class="post-metadata">

**Author:** ![buaaytt](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@buaaytt](https://discuss.elastic.co/u/buaaytt)\
**Post date:** [November 1, 2021, 6:08am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/8 "2021-11-01T06:08:39Z")

</div>

For anyone looking for elaboration of the pattern string, I found [this link](https://www.elastic.co/guide/en/elasticsearch/reference/7.15/multi-index.html) for reference.

---

<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:** [November 29, 2021, 6:09am UTC](https://discuss.elastic.co/t/how-can-i-get-the-count-of-all-indices/288047/9 "2021-11-29T06:09:38Z")

</div>

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