How to get the size of an index through java api

Hi,

     How to get the size of an index through java api. I searched on 

web i did n't get any solution for me. please resolve my problem,

thanks
Ravikumar Kotta

First you need to get IndicesStats

IndicesStats stats = client.admin().indices().prepareStats()
.clear()
.setIndices("twitter")
.setStore(true)
.execute().actionGet();

And then use it to get total index size:

long bytes = stats.index("twitter").getTotal().getStore().getSize().bytes();

On Tuesday, May 29, 2012 9:03:59 AM UTC-4, ravi kumar wrote:

Hi,

     How to get the size of an index through java api. I searched on 

web i did n't get any solution for me. please resolve my problem,

thanks
Ravikumar Kotta