9951 explained code solutions for 126 technologies

elasticsearchHow do I get a list of all indexes in Elasticsearch?

To get a list of all indexes in an Elasticsearch cluster, you can use the cat indices API. This API provides a concise summary of the health of all indices in a cluster.

Example code

GET /_cat/indices?v

Example output:

health status index    uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   test1   nHG_L0e3Qz-TnVHXV3dFVQ   5   1          0            0     4.3kb         4.3kb

Code explanation

  • GET: The HTTP verb for the request.
  • /_cat/indices: The path to the Elasticsearch endpoint for retrieving a list of indices.
  • ?v: The query parameter for verbose output.

Helpful links

Edit this code on GitHub