# How to get index size with jest/transport client

**URL:** <https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767>\
**Category:** Elasticsearch\
**Created:** [August 11, 2016, 7:54am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767 "2016-08-11T07:54:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meriem\_Rezgui](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@Meriem\_Rezgui](https://discuss.elastic.co/u/Meriem_Rezgui)\
**Post date:** [August 11, 2016, 7:54am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/1 "2016-08-11T07:54:57Z")

</div>

hello

i want to find a way to get an index size with jest or transport client like with the curl command "curl localhost:9200/index1,index2/\_stats" i didn't find anything in the documentation . can anyone help please

thanks

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [August 11, 2016, 8:31am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/2 "2016-08-11T08:31:24Z")

</div>

Hi,

Using the Java API you can do something like:

```
IndicesStatsResponse rsp = client().admin().indices().prepareStats("test").get();
```

---

<div class="post-metadata">

**Author:** ![Meriem\_Rezgui](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@Meriem\_Rezgui](https://discuss.elastic.co/u/Meriem_Rezgui)\
**Post date:** [August 11, 2016, 9:10am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/3 "2016-08-11T09:10:37Z")

</div>

> [@tanguy](#):
>
> IndicesStatsResponse rsp = client().admin().indices().prepareStats("test").get();

thanks a lot but is there a way to choose what i want to print for example if i want just to have store field !  
thanks

---

<div class="post-metadata">

**Author:** ![tanguy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy/32/6030_2.png) [@tanguy](https://discuss.elastic.co/u/tanguy)\
**Post date:** [August 11, 2016, 9:11am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/4 "2016-08-11T09:11:47Z")

</div>

You can use `client().admin().indices().prepareStats("test").clear().setStore(true).get()`

---

<div class="post-metadata">

**Author:** ![Meriem\_Rezgui](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@Meriem\_Rezgui](https://discuss.elastic.co/u/Meriem_Rezgui)\
**Post date:** [August 11, 2016, 9:14am UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/5 "2016-08-11T09:14:14Z")

</div>

that's perfect thanks a lot 🙂

---

<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 5, 2017, 10:28pm UTC](https://discuss.elastic.co/t/how-to-get-index-size-with-jest-transport-client/57767/6 "2017-07-05T22:28:33Z")

</div>


