use of org.elasticsearch.action.admin.cluster.state.ClusterStateRequest in project graylog2-server by Graylog2.
the class Indices method getClosedIndices.
public Set<String> getClosedIndices(final IndexSet indexSet) {
final Set<String> closedIndices = Sets.newHashSet();
ClusterStateRequest csr = new ClusterStateRequest().nodes(false).routingTable(false).blocks(false).metaData(true);
ClusterState state = c.admin().cluster().state(csr).actionGet().getState();
UnmodifiableIterator<IndexMetaData> it = state.getMetaData().getIndices().valuesIt();
while (it.hasNext()) {
IndexMetaData indexMeta = it.next();
// Only search in our indices.
if (!indexMeta.getIndex().startsWith(indexSet.getIndexPrefix())) {
continue;
}
if (indexMeta.getState().equals(IndexMetaData.State.CLOSE)) {
closedIndices.add(indexMeta.getIndex());
}
}
return closedIndices;
}
Aggregations