Search code examples
curlelasticsearch

List all indexes on ElasticSearch server?


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:

{
  "ok" : true,
  "status" : 200,
  "name" : "El Aguila",
  "version" : {
    "number" : "0.19.3",
    "snapshot_build" : false
  },
  "tagline" : "You Know, for Search"
}

I want a list of all indexes..


Solution

  • For a concise list of all indices in your cluster, call

    curl http://localhost:9200/_aliases
    

    this will give you a list of indices and their aliases.

    If you want it pretty-printed, add pretty=true:

    curl http://localhost:9200/_aliases?pretty=true
    

    The result will look something like this, if your indices are called old_deuteronomy and mungojerrie:

    {
      "old_deuteronomy" : {
        "aliases" : { }
      },
      "mungojerrie" : {
        "aliases" : {
          "rumpleteazer" : { },
          "that_horrible_cat" : { }
        }
      }
    }