0
0
ElasticsearchHow-ToBeginner · 3 min read

How to List All Indexes in Elasticsearch Quickly

To list all indexes in Elasticsearch, use the GET _cat/indices?v API call. This command returns a table of all indexes with details like health, status, and document count.
📐

Syntax

The basic syntax to list all indexes in Elasticsearch is:

GET _cat/indices?v

Here:

  • GET is the HTTP method to retrieve data.
  • _cat/indices is the Elasticsearch API endpoint that lists indexes.
  • ?v adds headers to the output for clarity.
http
GET _cat/indices?v
💻

Example

This example shows how to list all indexes using curl in a terminal. It demonstrates the command and the expected output format.

bash
curl -X GET "localhost:9200/_cat/indices?v"
Output
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size yellow open my_index 1a2b3c4d5e6f7g8h9i0j 1 1 1000 0 5mb 2.5mb green open logs 0a1b2c3d4e5f6g7h8i9j 5 1 50000 10 50mb 25mb
⚠️

Common Pitfalls

Some common mistakes when listing indexes include:

  • Not including ?v which makes the output harder to read because it lacks headers.
  • Using the wrong HTTP method like POST instead of GET.
  • Trying to list indexes without proper permissions, which causes authorization errors.
bash
Wrong:
curl -X POST "localhost:9200/_cat/indices"

Right:
curl -X GET "localhost:9200/_cat/indices?v"
📊

Quick Reference

Here is a quick summary of the key points to list all indexes:

CommandDescription
GET _cat/indices?vList all indexes with headers for readability
curl -X GET "localhost:9200/_cat/indices?v"Example curl command to list indexes
?v parameterAdds column headers to output
Use GET methodRequired HTTP method for this API
Check permissionsEnsure user has rights to view indexes

Key Takeaways

Use the GET _cat/indices?v API to list all indexes clearly.
Always include ?v to get readable column headers in the output.
Use the GET HTTP method, not POST or others.
Ensure your user has permission to access index information.
The curl command is a simple way to run this query from a terminal.