How can I get the count of all indices?

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


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.

Got something like this:

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

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?

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

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?

It means

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


For anyone looking for elaboration of the pattern string, I found this link for reference.

1 Like

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