org.apache.solr.client.solrj.request

## Class CollectionAdminRequest<T extends CollectionAdminResponse>

- java.lang.Object
- - org.apache.solr.client.solrj.SolrRequest<T>
  - - org.apache.solr.client.solrj.request.CollectionAdminRequest<T>

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  CollectionAdminRequest.AsyncCollectionAdminRequest, CollectionAdminRequest.ClusterProp, CollectionAdminRequest.ClusterStatus, CollectionAdminRequest.DeleteStatus, CollectionAdminRequest.List, CollectionAdminRequest.RequestStatus, CollectionAdminRequest.ShardSpecificAdminRequest

    public abstract class CollectionAdminRequest<T extends CollectionAdminResponse>
    extends SolrRequest<T>

This class is experimental and subject to change.

Since:
  solr 4.5
See Also:
  Serialized Form

### Nested Class Summary

Nested Classes
`static class` `CollectionAdminRequest.AddReplica`
`static class` `CollectionAdminRequest.AddReplicaProp`
`static class` `CollectionAdminRequest.AddRole`
`static class` `CollectionAdminRequest.AsyncCollectionAdminRequest` Base class for asynchronous collection admin requests
`protected static class` `CollectionAdminRequest.AsyncCollectionSpecificAdminRequest`
`protected static class` `CollectionAdminRequest.AsyncShardSpecificAdminRequest`
`static class` `CollectionAdminRequest.Backup`
`static class` `CollectionAdminRequest.BalanceShardUnique`
`static class` `CollectionAdminRequest.ClusterProp`
`static class` `CollectionAdminRequest.ClusterStatus`
`protected static class` `CollectionAdminRequest.CollectionAdminRoleRequest`
`static class` `CollectionAdminRequest.Create`
`static class` `CollectionAdminRequest.CreateAlias`
`static class` `CollectionAdminRequest.CreateShard`
`static class` `CollectionAdminRequest.CreateSnapshot`
`static class` `CollectionAdminRequest.Delete`
`static class` `CollectionAdminRequest.DeleteAlias`
`static class` `CollectionAdminRequest.DeleteNode`
`static class` `CollectionAdminRequest.DeleteReplica`
`static class` `CollectionAdminRequest.DeleteReplicaProp`
`static class` `CollectionAdminRequest.DeleteShard`
`static class` `CollectionAdminRequest.DeleteSnapshot`
`static class` `CollectionAdminRequest.DeleteStatus`
`static class` `CollectionAdminRequest.ForceLeader`
`static class` `CollectionAdminRequest.List`
`static class` `CollectionAdminRequest.ListSnapshots`
`static class` `CollectionAdminRequest.Migrate`
`static class` `CollectionAdminRequest.MigrateClusterState`
`static class` `CollectionAdminRequest.OverseerStatus`
`static class` `CollectionAdminRequest.RebalanceLeaders`
`static class` `CollectionAdminRequest.Reload`
`static class` `CollectionAdminRequest.RemoveRole`
`static class` `CollectionAdminRequest.ReplaceNode`
`static class` `CollectionAdminRequest.RequestStatus`
`static class` `CollectionAdminRequest.RequestStatusResponse` A response object for `CollectionAdminRequest.RequestStatus` requests
`static class` `CollectionAdminRequest.Restore`
`protected static class` `CollectionAdminRequest.ShardSpecificAdminRequest`
`static class` `CollectionAdminRequest.SplitShard`

### Nested classes/interfaces inherited from class org.apache.solr.client.solrj.SolrRequest

`SolrRequest.METHOD`

### Field Summary

Fields
`protected CollectionParams.CollectionAction` `action`

### Constructor Summary

Constructors
Constructor and Description
`CollectionAdminRequest(CollectionParams.CollectionAction action)`
`CollectionAdminRequest(String path, CollectionParams.CollectionAction action)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `addProperties(ModifiableSolrParams params, Properties props)`
`static CollectionAdminRequest.AddReplica` `addReplicaByRouteKey(String collection, String routeKey)` Returns a SolrRequest to add a replica to a collection using a route key
`static CollectionAdminRequest.AddReplicaProp` `addReplicaProperty(String collection, String shard, String replica, String propertyName, String propertyValue)` Returns a SolrRequest to add a property to a specific replica
`static CollectionAdminRequest.AddReplica` `addReplicaToShard(String collection, String shard)` Returns a SolrRequest to add a replica to a shard in a collection
`static CollectionAdminRequest.AddRole` `addRole(String node, String role)` Returns a SolrRequest to add a role to a node
`static CollectionAdminRequest.Backup` `backupCollection(String collection, String backupName)`
`static CollectionAdminRequest.BalanceShardUnique` `balanceReplicaProperty(String collection, String propertyName)` Returns a SolrRequest to balance a replica property across the shards of a collection
`static CollectionAdminRequest.CreateAlias` `createAlias(String aliasName, String aliasedCollections)` Returns a SolrRequest to create a new alias
`static CollectionAdminRequest.Create` `createCollection(String collection, int numShards, int numReplicas)` Returns a SolrRequest for creating a collection using a default configSet This requires that there is either a single configset configured in the cluster, or that there is a configset with the same name as the collection
`static CollectionAdminRequest.Create` `createCollection(String collection, String config, int numShards, int numReplicas)` Returns a SolrRequest for creating a collection
`static CollectionAdminRequest.Create` `createCollectionWithImplicitRouter(String collection, String config, String shards, int numReplicas)` Returns a SolrRequest for creating a collection with the implicit router
`static CollectionAdminRequest.CreateShard` `createShard(String collection, String shard)` Returns a SolrRequest to create a new shard in a collection
`static CollectionAdminRequest.DeleteAlias` `deleteAlias(String aliasName)` Returns a SolrRequest to delete an alias
`static CollectionAdminRequest.DeleteStatus` `deleteAllAsyncIds()`
`static CollectionAdminRequest.DeleteStatus` `deleteAsyncId(String requestId)` Returns a SolrRequest to delete an asynchronous request status
`static CollectionAdminRequest.Delete` `deleteCollection(String collection)` Returns a SolrRequest to delete a collection
`static CollectionAdminRequest.DeleteReplica` `deleteReplica(String collection, String shard, String replica)` Returns a SolrRequest to delete a replica from a shard in a collection
`static CollectionAdminRequest.DeleteReplicaProp` `deleteReplicaProperty(String collection, String shard, String replica, String propertyName)` Returns a SolrRequest to delete a property from a specific replica
`static CollectionAdminRequest.DeleteReplica` `deleteReplicasFromAllShards(String collection, int count)`
`static CollectionAdminRequest.DeleteReplica` `deleteReplicasFromShard(String collection, String shard, int count)` Returns a SolrRequest to remove a number of replicas from a specific shard
`static CollectionAdminRequest.DeleteShard` `deleteShard(String collection, String shard)` Returns a SolrRequest to delete a shard from a collection
`static CollectionAdminRequest.ForceLeader` `forceLeaderElection(String collection, String shard)` Returns a SolrRequest to force a leader election for a shard in a collection WARNING: This may cause data loss if the new leader does not contain updates acknowledged by the old leader.
`static CollectionAdminRequest.ClusterStatus` `getClusterStatus()` Return a SolrRequest to get the Cluster status
`Collection<ContentStream>` `getContentStreams()`
`static CollectionAdminRequest.OverseerStatus` `getOverseerStatus()` Return a SolrRequest to get the Overseer status
`SolrParams` `getParams()`
`static CollectionAdminRequest.List` `listCollections()` Returns a SolrRequest to get a list of collections in the cluster
`static CollectionAdminRequest.MigrateClusterState` `migrateCollectionFormat(String collection)` Returns a SolrRequest to migrate a collection state format This is an expert-level request, and should not generally be necessary.
`static CollectionAdminRequest.Migrate` `migrateData(String collection, String targetCollection, String splitKey)` Returns a SolrRequest to migrate data matching a split key to another collection
`static CollectionAdminRequest.RebalanceLeaders` `rebalanceLeaders(String collection)`
`static CollectionAdminRequest.Reload` `reloadCollection(String collection)` Returns a SolrRequest to reload a collection
`static CollectionAdminRequest.RemoveRole` `removeRole(String node, String role)` Returns a SolrRequest to remove a role from a node
`static CollectionAdminRequest.RequestStatus` `requestStatus(String requestId)` Returns a SolrRequest for checking the status of an asynchronous request
`static CollectionAdminRequest.Restore` `restoreCollection(String collection, String backupName)`
`static CollectionAdminRequest.ClusterProp` `setClusterProperty(String propertyName, String propertyValue)` Returns a SolrRequest to set a cluster property
`static CollectionAdminRequest.SplitShard` `splitShard(String collection)` Returns a SolrRequest to split a shard in a collection
`static void` `waitForAsyncRequest(String requestId, SolrClient client, long timeout)`

### Methods inherited from class org.apache.solr.client.solrj.SolrRequest

`createResponse, getBasicAuthPassword, getBasicAuthUser, getMethod, getPath, getQueryParams, getResponseParser, getStreamingResponseCallback, process, process, setBasicAuthCredentials, setMethod, setPath, setQueryParams, setResponseParser, setStreamingResponseCallback`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### action

    protected final CollectionParams.CollectionAction action

### Constructor Detail

#### CollectionAdminRequest

    public CollectionAdminRequest(CollectionParams.CollectionAction action)

#### CollectionAdminRequest

    public CollectionAdminRequest(String path,
                                  CollectionParams.CollectionAction action)

### Method Detail

#### getParams

    public SolrParams getParams()

Specified by:
  `getParams` in class `SolrRequest<T extends CollectionAdminResponse>`

#### getContentStreams

    public Collection<ContentStream> getContentStreams()
                                                throws IOException

Specified by:
  `getContentStreams` in class `SolrRequest<T extends CollectionAdminResponse>`
Throws:
  `IOException`

#### addProperties

    protected void addProperties(ModifiableSolrParams params,
                                 Properties props)

#### createCollection

    public static CollectionAdminRequest.Create createCollection(String collection,
                                                                 String config,
                                                                 int numShards,
                                                                 int numReplicas)

Returns a SolrRequest for creating a collection

Parameters:
  `collection` - the collection name
  `config` - the collection config
  `numShards` - the number of shards in the collection
  `numReplicas` - the replication factor of the collection

#### createCollection

    public static CollectionAdminRequest.Create createCollection(String collection,
                                                                 int numShards,
                                                                 int numReplicas)

Returns a SolrRequest for creating a collection using a default configSet This requires that there is either a single configset configured in the cluster, or that there is a configset with the same name as the collection

Parameters:
  `collection` - the collection name
  `numShards` - the number of shards in the collection
  `numReplicas` - the replication factor of the collection

#### createCollectionWithImplicitRouter

    public static CollectionAdminRequest.Create createCollectionWithImplicitRouter(String collection,
                                                                                   String config,
                                                                                   String shards,
                                                                                   int numReplicas)

Returns a SolrRequest for creating a collection with the implicit router

Parameters:
  `collection` - the collection name
  `config` - the collection config
  `shards` - a shard definition string
  `numReplicas` - the replication factor of the collection

#### reloadCollection

    public static CollectionAdminRequest.Reload reloadCollection(String collection)

Returns a SolrRequest to reload a collection

#### rebalanceLeaders

    public static CollectionAdminRequest.RebalanceLeaders rebalanceLeaders(String collection)

#### deleteCollection

    public static CollectionAdminRequest.Delete deleteCollection(String collection)

Returns a SolrRequest to delete a collection

#### backupCollection

    public static CollectionAdminRequest.Backup backupCollection(String collection,
                                                                 String backupName)

#### restoreCollection

    public static CollectionAdminRequest.Restore restoreCollection(String collection,
                                                                   String backupName)

#### createShard

    public static CollectionAdminRequest.CreateShard createShard(String collection,
                                                                 String shard)

Returns a SolrRequest to create a new shard in a collection

#### splitShard

    public static CollectionAdminRequest.SplitShard splitShard(String collection)

Returns a SolrRequest to split a shard in a collection

#### deleteShard

    public static CollectionAdminRequest.DeleteShard deleteShard(String collection,
                                                                 String shard)

Returns a SolrRequest to delete a shard from a collection

#### forceLeaderElection

    public static CollectionAdminRequest.ForceLeader forceLeaderElection(String collection,
                                                                         String shard)

Returns a SolrRequest to force a leader election for a shard in a collection WARNING: This may cause data loss if the new leader does not contain updates acknowledged by the old leader. Use only if leadership elections are entirely broken.

#### requestStatus

    public static CollectionAdminRequest.RequestStatus requestStatus(String requestId)

Returns a SolrRequest for checking the status of an asynchronous request

See Also:
  `CollectionAdminRequest.AsyncCollectionAdminRequest`

#### waitForAsyncRequest

    public static void waitForAsyncRequest(String requestId,
                                           SolrClient client,
                                           long timeout)
                                    throws SolrServerException,
                                           InterruptedException,
                                           IOException

Throws:
  `SolrServerException`
  `InterruptedException`
  `IOException`

#### deleteAsyncId

    public static CollectionAdminRequest.DeleteStatus deleteAsyncId(String requestId)

Returns a SolrRequest to delete an asynchronous request status

#### deleteAllAsyncIds

    public static CollectionAdminRequest.DeleteStatus deleteAllAsyncIds()

#### createAlias

    public static CollectionAdminRequest.CreateAlias createAlias(String aliasName,
                                                                 String aliasedCollections)

Returns a SolrRequest to create a new alias

Parameters:
  `aliasName` - the alias name
  `aliasedCollections` - the collections to alias

#### deleteAlias

    public static CollectionAdminRequest.DeleteAlias deleteAlias(String aliasName)

Returns a SolrRequest to delete an alias

#### addReplicaToShard

    public static CollectionAdminRequest.AddReplica addReplicaToShard(String collection,
                                                                      String shard)

Returns a SolrRequest to add a replica to a shard in a collection

#### addReplicaByRouteKey

    public static CollectionAdminRequest.AddReplica addReplicaByRouteKey(String collection,
                                                                         String routeKey)

Returns a SolrRequest to add a replica to a collection using a route key

#### deleteReplica

    public static CollectionAdminRequest.DeleteReplica deleteReplica(String collection,
                                                                     String shard,
                                                                     String replica)

Returns a SolrRequest to delete a replica from a shard in a collection

#### deleteReplicasFromShard

    public static CollectionAdminRequest.DeleteReplica deleteReplicasFromShard(String collection,
                                                                               String shard,
                                                                               int count)

Returns a SolrRequest to remove a number of replicas from a specific shard

#### deleteReplicasFromAllShards

    public static CollectionAdminRequest.DeleteReplica deleteReplicasFromAllShards(String collection,
                                                                                   int count)

#### setClusterProperty

    public static CollectionAdminRequest.ClusterProp setClusterProperty(String propertyName,
                                                                        String propertyValue)

Returns a SolrRequest to set a cluster property

#### migrateData

    public static CollectionAdminRequest.Migrate migrateData(String collection,
                                                             String targetCollection,
                                                             String splitKey)

Returns a SolrRequest to migrate data matching a split key to another collection

#### addRole

    public static CollectionAdminRequest.AddRole addRole(String node,
                                                         String role)

Returns a SolrRequest to add a role to a node

#### removeRole

    public static CollectionAdminRequest.RemoveRole removeRole(String node,
                                                               String role)

Returns a SolrRequest to remove a role from a node

#### getOverseerStatus

    public static CollectionAdminRequest.OverseerStatus getOverseerStatus()

Return a SolrRequest to get the Overseer status

#### getClusterStatus

    public static CollectionAdminRequest.ClusterStatus getClusterStatus()

Return a SolrRequest to get the Cluster status

#### listCollections

    public static CollectionAdminRequest.List listCollections()

Returns a SolrRequest to get a list of collections in the cluster

#### addReplicaProperty

    public static CollectionAdminRequest.AddReplicaProp addReplicaProperty(String collection,
                                                                           String shard,
                                                                           String replica,
                                                                           String propertyName,
                                                                           String propertyValue)

Returns a SolrRequest to add a property to a specific replica

#### deleteReplicaProperty

    public static CollectionAdminRequest.DeleteReplicaProp deleteReplicaProperty(String collection,
                                                                                 String shard,
                                                                                 String replica,
                                                                                 String propertyName)

Returns a SolrRequest to delete a property from a specific replica

#### migrateCollectionFormat

    public static CollectionAdminRequest.MigrateClusterState migrateCollectionFormat(String collection)

Returns a SolrRequest to migrate a collection state format This is an expert-level request, and should not generally be necessary.

#### balanceReplicaProperty

    public static CollectionAdminRequest.BalanceShardUnique balanceReplicaProperty(String collection,
                                                                                   String propertyName)

Returns a SolrRequest to balance a replica property across the shards of a collection