# How to use rest to display all the available indices?

**URL:** https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156
**Category:** Elasticsearch
**Created:** [August 28, 2019, 3:32pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156 "2019-08-28T15:32:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Bob94](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Bob94](https://discuss.elastic.co/u/Bob94)
#### Post date: [August 28, 2019, 3:32pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156/1 "2019-08-28T15:32:56Z")

</div>

Hi  
Is there any way to list out all the indices by using rest api and java ?

Some tutorial and example is really appreciated!

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 28, 2019, 3:45pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156/2 "2019-08-28T15:45:39Z")

</div>

use the \_cat/indices API [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html)

Example verbose sort by index name  
`curl http://localhost:9200/_cat/indices?v&s=index`

---

<div class="post-metadata">

### Author: ![Bob94](https://avatars.discourse-cdn.com/v4/letter/b/c89c15/32.png) [@Bob94](https://discuss.elastic.co/u/Bob94)
#### Post date: [August 28, 2019, 4:12pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156/3 "2019-08-28T16:12:46Z")

</div>

Hi stephen,

Yes for this curl and cat usage i know already, but i was having some confusion on hownto implement it on java code ?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [August 28, 2019, 4:35pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156/4 "2019-08-28T16:35:26Z")

</div>

Apologies I missed that .... yes does not appear there is a direct Java API mapping to the `_cat` APIs but I believe you can do something like this

```auto
client.admin().indices()
      .getIndex(new GetIndexRequest())
      .actionGet().getIndices();

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 25, 2019, 4:35pm UTC](https://discuss.elastic.co/t/how-to-use-rest-to-display-all-the-available-indices/197156/5 "2019-09-25T16:35:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
