private static void addMissingReplicas(SolrCloudManager cloudManager, Suggestion.Ctx ctx) throws IOException { cloudManager.getClusterStateProvider().getClusterState().forEachCollection(coll -> coll.forEach(slice -> { ReplicaCount replicaCount = new ReplicaCount(); slice.forEach(replica -> { if (replica.getState() == Replica.State.ACTIVE || replica.getState() == Replica.State.RECOVERING) { replicaCount.increment(replica.getType()); } }); addMissingReplicas(replicaCount, coll, slice.getName(), Replica.Type.NRT, ctx); addMissingReplicas(replicaCount, coll, slice.getName(), Replica.Type.PULL, ctx); addMissingReplicas(replicaCount, coll, slice.getName(), Replica.Type.TLOG, ctx); } )); }