List all indexes on ElasticSearch server?

前端 未结 23 1121
被撕碎了的回忆
被撕碎了的回忆 2020-12-12 09:55

I would like to list all indexes present on an ElasticSearch server. I tried this:

curl -XGET localhost:9200/

but it just gives me this:

23条回答
  •  借酒劲吻你
    2020-12-12 10:16

    The _stats command provides ways to customize the results by specifying the metrics wished. To get the indices the query is as follows:

    GET /_stats/indices
    

    The general format of the _stats query is:

    /_stats
    /_stats/{metric}
    /_stats/{metric}/{indexMetric}
    /{index}/_stats
    /{index}/_stats/{metric}
    

    Where the metrics are:

    indices, docs, store, indexing, search, get, merge, 
    refresh, flush, warmer, filter_cache, id_cache, 
    percolate, segments, fielddata, completion
    

    As an exercice to myself, I've written a small elasticsearch plugin providing the functionality to list elasticsearch indices without any other information. You can find it at the following url:

    http://blog.iterativ.ch/2014/04/11/listindices-writing-your-first-elasticsearch-java-plugin/

    https://github.com/iterativ/elasticsearch-listindices

提交回复
热议问题