使用java获取Elasticsearch索引中segment的数量

今天需要获取segment的数量  但是翻遍了百度都找不到  

最后是领导在programcreek中帮我找到的

IndicesStatsResponse stats = client.admin().indices().prepareStats(indexName).setSegments(true).get();

 stats.getTotal().getSegments().getCount();

client是链接es的,这个网上很多自行百度

猜你喜欢

转载自blog.csdn.net/ma1476684479/article/details/79995158
今日推荐