TransportClient client = EsClient.getTransportClient();
try {
IndicesSegmentsRequest request = new IndicesSegmentsRequest();
request.indices(“logs_write”);
ActionFuture responseFuture = client.admin().indices().segments(request);
IndicesSegmentResponse response = responseFuture.get();
System.out.println(response);
} catch (Throwable e) {
e.printStackTrace();
} finally {
EsClient.close(client);
}
}
返回结果类似:
{
“_shards”: …
“indices”: {
“test”: {
“shards”: {
“0”: [
{
“routing”: {
“state”: “STARTED”,
“primary”: true,
“node”: “zDC_RorJQCao9xf9pg3Fvw”
},
“num_committed_segments”: 0,
“num_search_segments”: 1,
“segments”: {
“_0”: {
“generation”: 0,