2015-10-14 55 views

回答

10

這絕對是可能的,但遺憾的是,它並沒有在Java客戶端的官方文檔中記錄。

List<IndexMetaData> indices = client.admin().cluster() 
    .prepareState().get().getState() 
    .getMetaData().getIndices(); 
8

的另一種方式,我發現做到這一點:

client.admin() 
    .indices() 
    .getIndex(new GetIndexRequest()) 
    .actionGet() 
    .getIndices() 
+3

萬一別人送過來,並想知道,這個方法返回一個String []這可能是比較容易處理,你可以做到這一點用。 – 2016-09-26 14:55:05

+0

是的..這一個更簡單的方法:D – thekucays

相關問題