# Shards and Index states through Java Client

**URL:** <https://discuss.elastic.co/t/shards-and-index-states-through-java-client/351241>\
**Category:** Elasticsearch\
**Created:** [January 17, 2024, 8:49am UTC](https://discuss.elastic.co/t/shards-and-index-states-through-java-client/351241 "2024-01-17T08:49:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avnere](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@avnere](https://discuss.elastic.co/u/avnere)\
**Post date:** [January 17, 2024, 8:49am UTC](https://discuss.elastic.co/t/shards-and-index-states-through-java-client/351241/1 "2024-01-17T08:49:43Z")

</div>

Hi,

I am looking a way to get Shards and Index states through Java Client 7.17

The states getting from:  
GET \_cat/indices/?v  
GET \_cat/shards/?v

Is it possible though HighLevelRestAPI?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 17, 2024, 10:23am UTC](https://discuss.elastic.co/t/shards-and-index-states-through-java-client/351241/2 "2024-01-17T10:23:35Z")

</div>

You can not with the HighLevelRestAPI but anyway you should switch to the new Java Client as the High Level one is deprecated in 7.17 and removed in 8.x.

With the new Java Client you can easily do that:

> <https://github.com/dadoonet/elasticsearch-java-client-demo/blob/760dbf4a2efa92a24183a8945a6f35d4016f6c61/src/test/java/fr/pilato/test/elasticsearch/hlclient/EsClientIT.java#L575-L578>

If you don't want to move to the new client, you will need to use the low level client instead and call manually the endpoint and interpret the response.  
Or run get Indices API instead.

---

<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:** [February 14, 2024, 10:24am UTC](https://discuss.elastic.co/t/shards-and-index-states-through-java-client/351241/3 "2024-02-14T10:24:03Z")

</div>

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