List all indexes on ElasticSearch server?
Categories:
How to List All Indexes on an Elasticsearch Server

Discover various methods to retrieve a comprehensive list of all indexes present on your Elasticsearch cluster, using both command-line tools and the Kibana interface.
Elasticsearch is a powerful search and analytics engine that stores data in structures called indexes. As your data grows and your applications evolve, you'll often need to inspect or manage these indexes. Knowing how to quickly list all available indexes is a fundamental skill for any Elasticsearch administrator or developer. This article will guide you through several common methods to achieve this, from simple curl
commands to using the Kibana Dev Tools console.
Understanding Elasticsearch Indexes
Before diving into the commands, it's helpful to understand what an Elasticsearch index represents. An index is a collection of documents that have similar characteristics. For example, you might have an index for 'customer data', another for 'product catalog', and yet another for 'application logs'. Each index is logically independent and can be configured with its own settings, mappings, and analysis. When you query Elasticsearch, you typically specify which index or indexes you want to search.
flowchart TD A[Elasticsearch Cluster] --> B(Index 1: 'logs-2023-01') A --> C(Index 2: 'users') A --> D(Index 3: 'products') B --> B1[Documents] C --> C1[Documents] D --> D1[Documents] subgraph Index Structure B1 --> B2[Mappings] B1 --> B3[Settings] end subgraph Index Structure C1 --> C2[Mappings] C1 --> C3[Settings] end subgraph Index Structure D1 --> D2[Mappings] D1 --> D3[Settings] end
Conceptual diagram of an Elasticsearch cluster with multiple indexes.
Method 1: Using the _cat/indices
API with curl
The _cat
API provides a human-readable output for various cluster statistics, including indexes. It's one of the most common and straightforward ways to list indexes directly from your terminal. You can use curl
to interact with this API. The _cat/indices
endpoint gives you a summary of each index, including its health, status, document count, and size.
curl -X GET "localhost:9200/_cat/indices?v&pretty"
Basic curl
command to list all indexes with verbose output.
Let's break down the command:
curl -X GET
: Specifies an HTTP GET request."localhost:9200"
: The address and port of your Elasticsearch instance. Replacelocalhost:9200
with your actual host and port if different./_cat/indices
: The_cat
API endpoint for indexes.?v
: Adds verbose output, including column headers.&pretty
: Formats the JSON output for better readability (though_cat
APIs are already human-readable, this can be useful for other_cat
endpoints that return JSON by default).
_cat/indices
by adding a pattern. For example, to list only indexes starting with 'log', use _cat/indices/log*?v
.Method 2: Using Kibana Dev Tools Console
If you have Kibana set up, its Dev Tools console offers a convenient and interactive way to send requests to Elasticsearch. This is often preferred for its user-friendly interface and syntax highlighting.
1. Open Kibana Dev Tools
Navigate to your Kibana instance (usually localhost:5601
). In the left-hand navigation menu, find and click on 'Dev Tools'.
2. Execute the _cat/indices
command
In the console editor, type the following command and then click the green play button to execute it:
GET _cat/indices?v
Listing indexes in Kibana Dev Tools.
The output will appear in the right-hand panel, showing a table of your indexes similar to the curl
output. Kibana Dev Tools automatically handles the pretty
formatting and provides a clean interface for interacting with your cluster.
curl
syntax or deal with command-line escaping.Method 3: Using the _cluster/state
API (Advanced)
For a more detailed, programmatic view of your cluster's state, including all indexes and their metadata, you can use the _cluster/state
API. This API returns a large JSON object containing extensive information about the cluster, including index settings, mappings, and aliases. While powerful, it's generally overkill if you just need a list of index names.
curl -X GET "localhost:9200/_cluster/state?pretty&filter_path=metadata.indices.*.settings.index.uuid,metadata.indices.*.aliases,metadata.indices.*.mappings"
Using _cluster/state
with filter_path
to get specific index metadata.
The filter_path
parameter is crucial here to reduce the verbosity of the output. Without it, you'd receive a massive JSON response. This method is more suited for programmatic access where you need specific details about each index beyond just its name and basic stats.
_cluster/state
API can return a very large response, especially on clusters with many indexes. Use filter_path
to retrieve only the necessary information to avoid performance issues or overwhelming your client.