# \[JAVA API\] Retrieve all indexes

**URL:** https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783
**Category:** Elasticsearch
**Created:** [September 15, 2014, 11:22am UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783 "2014-09-15T11:22:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Luan\_Garrido](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@Luan\_Garrido](https://discuss.elastic.co/u/Luan_Garrido)
#### Post date: [September 15, 2014, 11:22am UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783/1 "2014-09-15T11:22:40Z")

</div>

Hi all,  
First of all I took a look and did not find the answer for my question.  
Can anyone teach me how can I find all indexes from a cluster using the  
JAVA API?  
Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)
#### Post date: [September 15, 2014, 11:56am UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783/2 "2014-09-15T11:56:52Z")

</div>

Hello Luan ,

There are many ways to do it -

Client client = new TransportClient()  
.addTransportAddress(new InetSocketTransportAddress("host1", 9300));  
GetSettingsRequest req = new GetSettingsRequest();;  
GetSettingsResponse response =  
client.admin().indices().getSettings(req).actionGet();  
ImmutableOpenMap\<String, Settings\> settings = response.getIndexToSettings();  
System.out.println("Indices are " + settings.keys());

Thanks  
Vineeth

On Mon, Sep 15, 2014 at 4:52 PM, Luan Garrido [lbgarrido89@gmail.com](mailto:lbgarrido89@gmail.com) wrote:

> Hi all,  
> First of all I took a look and did not find the answer for my question.  
> Can anyone teach me how can I find all indexes from a cluster using the  
> JAVA API?  
> Thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/adf8f2c2-311e-4732-8c5e-97835798e573%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5karShQcL%2Bp0VFfCKgM7tUzmWhdCGfjca3ah7YSedOfTQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5karShQcL%2Bp0VFfCKgM7tUzmWhdCGfjca3ah7YSedOfTQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luan\_Garrido](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@Luan\_Garrido](https://discuss.elastic.co/u/Luan_Garrido)
#### Post date: [September 15, 2014, 2:33pm UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783/3 "2014-09-15T14:33:54Z")

</div>

Thank you for your healp Vineeth

Em segunda-feira, 15 de setembro de 2014 08h22min40s UTC-3, Luan Garrido  
escreveu:

> Hi all,  
> First of all I took a look and did not find the answer for my question.  
> Can anyone teach me how can I find all indexes from a cluster using the  
> JAVA API?  
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/29528fd4-7f84-4a4a-b689-1b7665a4714b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/29528fd4-7f84-4a4a-b689-1b7665a4714b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Luan\_Garrido](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@Luan\_Garrido](https://discuss.elastic.co/u/Luan_Garrido)
#### Post date: [September 15, 2014, 7:09pm UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783/4 "2014-09-15T19:09:58Z")

</div>

Vineeth, can you tell me how can I get the types of this index?  
I tried:

GetMappingsResponse response =  
this.client.admin().indices().prepareGetMappings(index).execute().actionGet();  
for(ObjectCursor st : response.mappings().keys()){  
System.out.println(st.value);  
}  
But it returned me the name of the index.

Thank you

Em segunda-feira, 15 de setembro de 2014 08h22min40s UTC-3, Luan Garrido  
escreveu:

> Hi all,  
> First of all I took a look and did not find the answer for my question.  
> Can anyone teach me how can I find all indexes from a cluster using the  
> JAVA API?  
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/960d95d7-1c21-43f3-b95f-98d6f2cf5e26%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/960d95d7-1c21-43f3-b95f-98d6f2cf5e26%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 1:02am UTC](https://discuss.elastic.co/t/java-api-retrieve-all-indexes/19783/5 "2017-07-06T01:02:09Z")

</div>


