Elasticsearch list indices sorted by name
You can ask ES to sort the results via the s
(sort) searchParameter using s=i
or s=index
curl "localhost:9200/_cat/indices?pretty&s=i"curl "localhost:9200/_cat/aliases?pretty&s=index"
To see the column's headers, add "&v" :
curl "localhost:9200/_cat/indices?pretty&v&s=index"`.
You can find some explanations in the cat/indices documentation
The best way for Elasticsearch 5x is like this:
GET _cat/aliases?v&s=index:desc&h=alias,index
Will give you:
alias indexapp-logs-alias app-logs-2017-12-31backend-logs-read backend-logs-2017-12-31
s = sort, v = various extra detail, h = headings to include,
I think that the best way to do this would be via the console. Something like this:
$ curl --silent 'http://path.to.cluster:9200/_cat/indices' | cut -d ' ' -f2 | sort