Example usage for org.apache.solr.client.solrj.request CollectionAdminRequest deleteReplica

List of usage examples for org.apache.solr.client.solrj.request CollectionAdminRequest deleteReplica

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.request CollectionAdminRequest deleteReplica.

Prototype

public static DeleteReplica deleteReplica(String collection, String shard, int count) 

Source Link

Usage

From source file:com.shaie.solr.solrj.CollectionAdminHelper.java

License:Apache License

/**
 * Deletes a replica from the given collection and shard. If the replica's node does not respond, the replica will
 * be deleted only from ZK.//from w w  w  . ja  va  2 s.c om
 */
public void deleteReplica(String collectionName, String shardName, String replicaName) {
    if (!collectionExists(collectionName)) {
        throw new IllegalArgumentException("collection [" + collectionName + "] does not exist");
    }

    try {
        final CollectionAdminRequest.DeleteReplica deleteReplicaRequest = CollectionAdminRequest
                .deleteReplica(collectionName, shardName, replicaName).setOnlyIfDown(false);
        deleteReplicaRequest.process(solrClient);
    } catch (IOException | SolrServerException e) {
        System.err.println("here");
        throw new RuntimeException(e);
    }
}