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
,V2RequestSupport
,MapSerializable
,MapWriter
,NavigableObject
- Direct Known Subclasses:
CollectionAdminRequest.AsyncCollectionAdminRequest
,CollectionAdminRequest.ClusterProp
,CollectionAdminRequest.ClusterStatus
,CollectionAdminRequest.DeleteStatus
,CollectionAdminRequest.List
,CollectionAdminRequest.ListAliases
,CollectionAdminRequest.RequestStatus
,CollectionAdminRequest.ShardSpecificAdminRequest
public abstract class CollectionAdminRequest<T extends CollectionAdminResponse> extends SolrRequest<T> implements V2RequestSupport, MapWriter
This class is experimental and subject to change.- Since:
- solr 4.5
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.client.solrj.SolrRequest
SolrRequest.METHOD
-
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected CollectionParams.CollectionAction
action
static List<String>
MODIFIABLE_COLLECTION_PROPERTIES
The set of modifiable collection propertiesstatic String
PROPERTY_PREFIX
-
Fields inherited from class org.apache.solr.client.solrj.SolrRequest
SUPPORTED_METHODS, useBinaryV2, usev2
-
-
Constructor Summary
Constructors Constructor Description CollectionAdminRequest(String path, CollectionParams.CollectionAction action)
CollectionAdminRequest(CollectionParams.CollectionAction action)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 keystatic CollectionAdminRequest.AddReplicaProp
addReplicaProperty(String collection, String shard, String replica, String propertyName, String propertyValue)
Returns a SolrRequest to add a property to a specific replicastatic CollectionAdminRequest.AddReplica
addReplicaToShard(String collection, String shard)
Returns a SolrRequest to add a replica of typeReplica.Type.NRT
to a shard in a collectionstatic CollectionAdminRequest.AddReplica
addReplicaToShard(String collection, String shard, Replica.Type replicaType)
Returns a SolrRequest to add a replica of the specified type to a shard in a collection.static CollectionAdminRequest.AddRole
addRole(String node, String role)
Returns a SolrRequest to add a role to a nodestatic 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 collectionstatic CollectionAdminRequest.ColStatus
collectionStatus(String collection)
Return a SolrRequest for low-level detailed status of the collection.static CollectionAdminRequest.CreateAlias
createAlias(String aliasName, String aliasedCollections)
Returns a SolrRequest to create a new aliasstatic CollectionAdminRequest.CreateCategoryRoutedAlias
createCategoryRoutedAlias(String aliasName, String routerField, int maxCardinality, CollectionAdminRequest.Create createCollTemplate)
Returns a SolrRequest to create a category routed 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 collectionstatic CollectionAdminRequest.Create
createCollection(String collection, String config, int numShards, int numReplicas)
Returns a SolrRequest for creating a collectionstatic CollectionAdminRequest.Create
createCollection(String collection, String config, Integer numShards, Integer numNrtReplicas, Integer numTlogReplicas, Integer numPullReplicas)
Returns a SolrRequest for creating a collectionstatic CollectionAdminRequest.Create
createCollectionWithImplicitRouter(String collection, String config, String shards, int numReplicas)
Returns a SolrRequest for creating a collection with the implicit routerstatic CollectionAdminRequest.Create
createCollectionWithImplicitRouter(String collection, String config, String shards, int numNrtReplicas, int numTlogReplicas, int numPullReplicas)
Returns a SolrRequest for creating a collection with the implicit router and specific types of replicasstatic CollectionAdminRequest.DimensionalRoutedAlias
createDimensionalRoutedAlias(String aliasName, CollectionAdminRequest.Create createCollTemplate, CollectionAdminRequest.RoutedAliasAdminRequest... dims)
Create a Dimensional Routed alias from two or more routed alias types.static CollectionAdminRequest.CreateShard
createShard(String collection, String shard)
Returns a SolrRequest to create a new shard in a collectionstatic CollectionAdminRequest.CreateTimeRoutedAlias
createTimeRoutedAlias(String aliasName, String start, String interval, String routerField, CollectionAdminRequest.Create createCollTemplate)
Returns a SolrRequest to create a time routed alias.static CollectionAdminRequest.DeleteAlias
deleteAlias(String aliasName)
Returns a SolrRequest to delete an aliasstatic CollectionAdminRequest.DeleteStatus
deleteAllAsyncIds()
Returns a SolrRequest to delete a all asynchronous request statusesstatic CollectionAdminRequest.DeleteStatus
deleteAsyncId(String requestId)
Returns a SolrRequest to delete an asynchronous request statusstatic CollectionAdminRequest.Delete
deleteCollection(String collection)
Returns a SolrRequest to delete a collectionstatic CollectionAdminRequest.DeleteNode
deleteNode(String node)
Returns a SolrRequest to delete a node.static CollectionAdminRequest.DeleteReplica
deleteReplica(String collection, String shard, int count)
static CollectionAdminRequest.DeleteReplica
deleteReplica(String collection, String shard, String replica)
Returns a SolrRequest to delete a replica from a shard in a collectionstatic CollectionAdminRequest.DeleteReplicaProp
deleteReplicaProperty(String collection, String shard, String replica, String propertyName)
Returns a SolrRequest to delete a property from a specific replicastatic 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 shardstatic CollectionAdminRequest.DeleteShard
deleteShard(String collection, String shard)
Returns a SolrRequest to delete a shard from a collectionstatic 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 statusstatic CollectionAdminRequest.OverseerStatus
getOverseerStatus()
Return a SolrRequest to get the Overseer statusSolrParams
getParams()
SolrRequest
getV2Request()
If usev2 flag is set to true, return V2Request, if not, return V1 request objectstatic List<String>
listCollections(SolrClient client)
Returns a SolrRequest to get a list of collections in the clusterstatic 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 collectionstatic CollectionAdminRequest.Modify
modifyCollection(String collection, Map<String,Object> properties)
Returns a SolrRequest for modifying a collection with the given propertiesstatic CollectionAdminRequest.MoveReplica
moveReplica(String collection, String replica, String targetNode)
static CollectionAdminRequest.RebalanceLeaders
rebalanceLeaders(String collection)
static CollectionAdminRequest.ReindexCollection
reindexCollection(String collection)
Returns a SolrRequest to reindex a collectionstatic CollectionAdminRequest.Reload
reloadCollection(String collection)
Returns a SolrRequest to reload a collectionstatic CollectionAdminRequest.RemoveRole
removeRole(String node, String role)
Returns a SolrRequest to remove a role from a nodestatic CollectionAdminRequest.Rename
renameCollection(String collection, String target)
static CollectionAdminRequest.RequestStatus
requestStatus(String requestId)
Returns a SolrRequest for checking the status of an asynchronous requeststatic CollectionAdminRequest.Restore
restoreCollection(String collection, String backupName)
static CollectionAdminRequest.SetAliasProperty
setAliasProperty(String aliasName)
Returns a SolrRequest to add or remove properties from an aliasstatic CollectionAdminRequest.ClusterProp
setClusterProperty(String propertyName, String propertyValue)
Returns a SolrRequest to set (or unset) a cluster propertystatic CollectionAdminRequest.CollectionProp
setCollectionProperty(String collection, String propertyName, String propertyValue)
static CollectionAdminRequest.SplitShard
splitShard(String collection)
Returns a SolrRequest to split a shard in a collectionString
toString()
static void
waitForAsyncRequest(String requestId, SolrClient client, long timeout)
void
writeMap(MapWriter.EntryWriter ew)
-
Methods inherited from class org.apache.solr.client.solrj.SolrRequest
addHeader, createResponse, getBasePath, getBasicAuthPassword, getBasicAuthUser, getCollection, getContentStreams, getContentWriter, getHeaders, getMethod, getPath, getQueryParams, getResponseParser, getStreamingResponseCallback, getUserPrincipal, process, process, setBasePath, setBasicAuthCredentials, setMethod, setPath, setQueryParams, setResponseParser, setStreamingResponseCallback, setUseBinaryV2, setUserPrincipal, setUseV2
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
-
-
-
-
Field Detail
-
MODIFIABLE_COLLECTION_PROPERTIES
public static final List<String> MODIFIABLE_COLLECTION_PROPERTIES
The set of modifiable collection properties
-
action
protected final CollectionParams.CollectionAction action
-
PROPERTY_PREFIX
public static String PROPERTY_PREFIX
-
-
Constructor Detail
-
CollectionAdminRequest
public CollectionAdminRequest(CollectionParams.CollectionAction action)
-
CollectionAdminRequest
public CollectionAdminRequest(String path, CollectionParams.CollectionAction action)
-
-
Method Detail
-
getV2Request
public SolrRequest getV2Request()
Description copied from interface:V2RequestSupport
If usev2 flag is set to true, return V2Request, if not, return V1 request object- Specified by:
getV2Request
in interfaceV2RequestSupport
-
getParams
public SolrParams getParams()
- Specified by:
getParams
in classSolrRequest<T extends CollectionAdminResponse>
-
addProperties
protected void addProperties(ModifiableSolrParams params, Properties props)
-
writeMap
public void writeMap(MapWriter.EntryWriter ew) throws IOException
- Specified by:
writeMap
in interfaceMapWriter
- Throws:
IOException
-
createCollection
public static CollectionAdminRequest.Create createCollection(String collection, String config, Integer numShards, Integer numNrtReplicas, Integer numTlogReplicas, Integer numPullReplicas)
Returns a SolrRequest for creating a collection- Parameters:
collection
- the collection nameconfig
- the collection confignumShards
- the number of shards in the collectionnumNrtReplicas
- the number ofReplica.Type.NRT
replicasnumTlogReplicas
- the number ofReplica.Type.TLOG
replicasnumPullReplicas
- the number ofReplica.Type.PULL
replicas
-
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 nameconfig
- the collection confignumShards
- the number of shards in the collectionnumReplicas
- the replication factor of the collection (same as numNrtReplicas)
-
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 namenumShards
- the number of shards in the collectionnumReplicas
- 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 nameconfig
- the collection configshards
- a shard definition stringnumReplicas
- the replication factor of the collection
-
createCollectionWithImplicitRouter
public static CollectionAdminRequest.Create createCollectionWithImplicitRouter(String collection, String config, String shards, int numNrtReplicas, int numTlogReplicas, int numPullReplicas)
Returns a SolrRequest for creating a collection with the implicit router and specific types of replicas- Parameters:
collection
- the collection nameconfig
- the collection configshards
- a shard definition stringnumNrtReplicas
- the number of replicas of typeReplica.Type.NRT
numTlogReplicas
- the number of replicas of typeReplica.Type.TLOG
numPullReplicas
- the number of replicas of typeReplica.Type.PULL
-
modifyCollection
public static CollectionAdminRequest.Modify modifyCollection(String collection, Map<String,Object> properties)
Returns a SolrRequest for modifying a collection with the given properties- Parameters:
collection
- the collection nameproperties
- a map of key and values with which the collection is to be modified
-
reloadCollection
public static CollectionAdminRequest.Reload reloadCollection(String collection)
Returns a SolrRequest to reload a collection
-
renameCollection
public static CollectionAdminRequest.Rename renameCollection(String collection, String target)
-
deleteNode
public static CollectionAdminRequest.DeleteNode deleteNode(String node)
Returns a SolrRequest to delete a node.
-
moveReplica
public static CollectionAdminRequest.MoveReplica moveReplica(String collection, String replica, String targetNode)
-
rebalanceLeaders
public static CollectionAdminRequest.RebalanceLeaders rebalanceLeaders(String collection)
-
reindexCollection
public static CollectionAdminRequest.ReindexCollection reindexCollection(String collection)
Returns a SolrRequest to reindex a collection
-
collectionStatus
public static CollectionAdminRequest.ColStatus collectionStatus(String collection)
Return a SolrRequest for low-level detailed status of the 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
-
waitForAsyncRequest
public static void waitForAsyncRequest(String requestId, SolrClient client, long timeout) 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()
Returns a SolrRequest to delete a all asynchronous request statuses
-
setAliasProperty
public static CollectionAdminRequest.SetAliasProperty setAliasProperty(String aliasName)
Returns a SolrRequest to add or remove properties from an alias- Parameters:
aliasName
- the alias to modify
-
createAlias
public static CollectionAdminRequest.CreateAlias createAlias(String aliasName, String aliasedCollections)
Returns a SolrRequest to create a new alias- Parameters:
aliasName
- the alias namealiasedCollections
- the collections to alias
-
createTimeRoutedAlias
public static CollectionAdminRequest.CreateTimeRoutedAlias createTimeRoutedAlias(String aliasName, String start, String interval, String routerField, CollectionAdminRequest.Create createCollTemplate)
Returns a SolrRequest to create a time routed alias. For time based routing, the start should be a standard Solr timestamp string (possibly with "date math").- Parameters:
aliasName
- the name of the alias to create.start
- the start of the routing. A standard Solr date: ISO-8601 or NOW with date math.interval
- date math representing the time duration of each collection (e.g.+1DAY
)routerField
- the document field to contain the timestamp to route oncreateCollTemplate
- Holds options to create a collection. The "name" is ignored.
-
createCategoryRoutedAlias
public static CollectionAdminRequest.CreateCategoryRoutedAlias createCategoryRoutedAlias(String aliasName, String routerField, int maxCardinality, CollectionAdminRequest.Create createCollTemplate)
Returns a SolrRequest to create a category routed alias.- Parameters:
aliasName
- the name of the alias to create.routerField
- the document field to contain the timestamp to route onmaxCardinality
- the maximum number of collections under this CRAcreateCollTemplate
- Holds options to create a collection. The "name" is ignored.
-
createDimensionalRoutedAlias
public static CollectionAdminRequest.DimensionalRoutedAlias createDimensionalRoutedAlias(String aliasName, CollectionAdminRequest.Create createCollTemplate, CollectionAdminRequest.RoutedAliasAdminRequest... dims)
Create a Dimensional Routed alias from two or more routed alias types.- Parameters:
aliasName
- The name of the aliascreateCollTemplate
- a create command that will be used for all collections createddims
- Routed Alias requests. Note that the aliasName and collection templates inside dimensions will be ignored and may be safely set to null- Returns:
- An object representing a basic DimensionalRoutedAlias creation request.
-
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 of typeReplica.Type.NRT
to a shard in a collection
-
addReplicaToShard
public static CollectionAdminRequest.AddReplica addReplicaToShard(String collection, String shard, Replica.Type replicaType)
Returns a SolrRequest to add a replica of the specified type to a shard in a collection. If the replica type is null, the server default will be used.
-
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
-
deleteReplica
public static CollectionAdminRequest.DeleteReplica deleteReplica(String collection, String shard, int count)
-
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 (or unset) a cluster property
-
setCollectionProperty
public static CollectionAdminRequest.CollectionProp setCollectionProperty(String collection, String propertyName, String propertyValue)
-
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 List<String> listCollections(SolrClient client) throws IOException, SolrServerException
Returns a SolrRequest to get a list of collections in the cluster- Throws:
IOException
SolrServerException
-
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
-
-