2015-10-14 184 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

相关问题