How to get all closed indices in Elasticsearch?

Viewed 648

I have a cluster and a few open and closed indexes inside.I want to get only closed indexes.

GET _cat/indices?v&s=status

this query getting all indices. I need a GET _cat/indices?v&s=status:'close' like this query.

Is this a possible?

2 Answers

You can get the list of closed indices using

http://localhost:9200/_cat/indices?v&s=status&expand_wildcards=closed

To know more about various other cat indices API parameters, refer to this documentation.

It can be done in a way similar to this one with grep to extract what you need

curl -s -XGET http://localhost:9200/_cat/indices | grep "close"
Related