# Rest client java code to fetch all indices

**URL:** <https://forum.opensearch.org/t/rest-client-java-code-to-fetch-all-indices/16122>\
**Category:** OpenSearch\
**Created:** [October 3, 2023, 5:04pm UTC](https://forum.opensearch.org/t/rest-client-java-code-to-fetch-all-indices/16122 "2023-10-03T17:04:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hello](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hello](https://forum.opensearch.org/u/hello)\
**Post date:** [October 3, 2023, 5:04pm UTC](https://forum.opensearch.org/t/rest-client-java-code-to-fetch-all-indices/16122/1 "2023-10-03T17:04:11Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):

**Describe the issue** :  
Please give a working java code that can fetch all indices of a cluster using java rest client version 2.1

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [October 4, 2023, 9:42pm UTC](https://forum.opensearch.org/t/rest-client-java-code-to-fetch-all-indices/16122/2 "2023-10-04T21:42:27Z")

</div>

@hello Is that what you’re looking for?

> <https://github.com/opensearch-project/opensearch-java/blob/main/guides/cat.md#cat-indices>
