How to get index size with jest/transport client

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

Hi,

Using the Java API you can do something like:

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

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

1 Like

that's perfect thanks a lot :slight_smile: