Class CollectionAdminRequest<T extends CollectionAdminResponse>
- All Implemented Interfaces:
Serializable,MapSerializable,MapWriter,NavigableObject,org.noggit.JSONWriter.Writable
- Direct Known Subclasses:
CollectionAdminRequest.AsyncCollectionAdminRequest,CollectionAdminRequest.ClusterProp,CollectionAdminRequest.ClusterStatus,CollectionAdminRequest.DeleteBackup,CollectionAdminRequest.DeleteStatus,CollectionAdminRequest.List,CollectionAdminRequest.ListAliases,CollectionAdminRequest.ListBackup,CollectionAdminRequest.RequestApiDistributedProcessing,CollectionAdminRequest.RequestStatus,CollectionAdminRequest.ShardSpecificAdminRequest
- Since:
- solr 4.5
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classBase class for asynchronous collection admin requestsprotected static classprotected static classstatic classstatic classstatic classstatic classprotected static classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classSolrRequestclass for the "Backup Deletion" API.static classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classSolrRequestclass for the "Backup List" API.static classstatic classstatic classstatic classA Modify Collection requeststatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classA response object forCollectionAdminRequest.RequestApiDistributedProcessingrequestsstatic classstatic classA response object forCollectionAdminRequest.RequestStatusrequestsstatic classstatic interfacestatic classprotected static classstatic classNested classes/interfaces inherited from class org.apache.solr.client.solrj.SolrRequest
SolrRequest.ApiVersion, SolrRequest.METHOD, SolrRequest.SolrClientContext, SolrRequest.SolrRequestTypeNested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CollectionParams.CollectionActionThe set of modifiable collection propertiesstatic StringDeprecated.Fields inherited from class org.apache.solr.client.solrj.SolrRequest
SUPPORTED_METHODS -
Constructor Summary
ConstructorsConstructorDescriptionCollectionAdminRequest(String path, CollectionParams.CollectionAction action) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddProperties(ModifiableSolrParams params, Properties props) addReplicaByRouteKey(String collection, String routeKey) Returns a SolrRequest to add a replica to a collection using a route keyaddReplicaProperty(String collection, String shard, String replica, String propertyName, String propertyValue) Returns a SolrRequest to add a property to a specific replicaaddReplicaToShard(String collection, String shard) Returns a SolrRequest to add a replica of typeReplica.Type.NRTto a shard in a collectionaddReplicaToShard(String collection, String shard, Replica.Type replicaType) Returns a SolrRequest to add a replica of the specified type to a shard in a collection.Returns a SolrRequest to add a role to a nodebackupCollection(String collection, String backupName) balanceReplicaProperty(String collection, String propertyName) Returns a SolrRequest to balance a replica property across the shards of a collectioncollectionStatus(String collection) Return a SolrRequest for low-level detailed status of the specified collection.Return a SolrRequest for low-level detailed status of all collections on the cluster.createAlias(String aliasName, String aliasedCollections) Returns a SolrRequest to create a new aliascreateCategoryRoutedAlias(String aliasName, String routerField, int maxCardinality, CollectionAdminRequest.Create createCollTemplate) Returns a SolrRequest to create a category routed alias.createCollection(String collection, int numShards, int numReplicas) Returns a SolrRequest for creating a collection using a default configSetcreateCollection(String collection, String config, int numShards, int numReplicas) Returns a SolrRequest for creating a collectioncreateCollection(String collection, String config, Integer numShards, Integer numNrtReplicas, Integer numTlogReplicas, Integer numPullReplicas) Returns a SolrRequest for creating a collectioncreateCollectionWithImplicitRouter(String collection, String config, String shards, int numReplicas) Returns a SolrRequest for creating a collection with the implicit routercreateCollectionWithImplicitRouter(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 replicascreateDimensionalRoutedAlias(String aliasName, CollectionAdminRequest.Create createCollTemplate, CollectionAdminRequest.RoutedAliasAdminRequest... dims) Create a Dimensional Routed alias from two or more routed alias types.createShard(String collection, String shard) Returns a SolrRequest to create a new shard in a collectioncreateTimeRoutedAlias(String aliasName, String start, String interval, String routerField, CollectionAdminRequest.Create createCollTemplate) Returns a SolrRequest to create a time routed alias.deleteAlias(String aliasName) Returns a SolrRequest to delete an aliasReturns a SolrRequest to delete a all asynchronous request statusesdeleteAsyncId(String requestId) Returns a SolrRequest to delete an asynchronous request statusdeleteBackupById(String backupName, int backupId) Configure aSolrRequestobject to delete a single backup-point by it's Backup ID.deleteBackupByRecency(String backupName, int numRecentBackupPointsToRetain) Create aSolrRequestobject to delete all backup-points after the most recent 'N'deleteBackupPurgeUnusedFiles(String backupName) Create aSolrRequestobject to delete all unused-files at the backup location.deleteCollection(String collection) Returns a SolrRequest to delete a collectiondeleteNode(String node) Returns a SolrRequest to delete a node.deleteReplica(String collection, String shard, int count) deleteReplica(String collection, String shard, String replica) Returns a SolrRequest to delete a replica from a shard in a collectiondeleteReplicaProperty(String collection, String shard, String replica, String propertyName) Returns a SolrRequest to delete a property from a specific replicadeleteReplicasFromAllShards(String collection, int count) deleteReplicasFromShard(String collection, String shard, int count) Returns a SolrRequest to remove a number of replicas from a specific sharddeleteShard(String collection, String shard) Returns a SolrRequest to delete a shard from a collectionforceLeaderElection(String collection, String shard) Returns a SolrRequest to force a leader election for a shard in a collectionReturn a SolrRequest to get the Cluster statusReturn a SolrRequest to get the Overseer statusThe parameters for this request; never null.installDataToShard(String collection, String shard, String location) Install index data to a specific shard of a specific collectioninstallDataToShard(String collection, String shard, String location, String backupRepository) Install index data to a specific shard of a specific collectionlistBackup(String backupName) Create aSolrRequestobject to list information about all backup points with the specified name.listCollections(SolrClient client) Returns a SolrRequest to get a list of collections in the clustermigrateData(String collection, String targetCollection, String splitKey) Returns a SolrRequest to migrate data matching a split key to another collectionmockCollTask(String collection) Returns a SolrRequest to run a mock task.modifyCollection(String collection, Map<String, Object> properties) Returns a SolrRequest for modifying a collection with the given propertiesmoveReplica(String collection, String replica, String targetNode) protected <T extends CollectionAdminRequest<? extends CollectionAdminResponse>>
TpropagateBasicAuthCreds(T req) Take the request specific basic auth creds on this admin request and propagate them to a related request if does not already have credentials set, such as a CollectionAdminRequest.RequestStatus when doing async requests.rebalanceLeaders(String collection) reindexCollection(String collection) Returns a SolrRequest to reindex a collectionreloadCollection(String collection) Returns a SolrRequest to reload a collectionremoveRole(String node, String role) Returns a SolrRequest to remove a role from a noderenameCollection(String collection, String target) requestStatus(String requestId) Returns a SolrRequest for checking the status of an asynchronous requestbooleanDetermines whether this request should use or ignore any specified collections (esp.restoreCollection(String collection, String backupName) setAliasProperty(String aliasName) Returns a SolrRequest to add or remove properties from an aliassetClusterProperty(String propertyName, String propertyValue) Returns a SolrRequest to set (or unset) a cluster propertysetCollectionProperty(String collection, String propertyName, String propertyValue) splitShard(String collection) Returns a SolrRequest to split a shard in a collectiontoString()static voidwaitForAsyncRequest(String requestId, SolrClient client, long timeout) voidWrites this object's entries out toew.Methods inherited from class org.apache.solr.client.solrj.SolrRequest
addHeader, addHeaders, createResponse, getApiVersion, getBasicAuthPassword, getBasicAuthUser, getCollection, getContentStreams, getContentWriter, getHeaders, getMethod, getPath, getPreferredNodes, getQueryParams, getRequestType, getResponseParser, getStreamingResponseCallback, getUserPrincipal, process, process, processWithBaseUrl, setBasicAuthCredentials, setMethod, setPath, setPreferredNodes, setQueryParams, setRequestType, setResponseParser, setStreamingResponseCallback, setUserPrincipalMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Field Details
-
MODIFIABLE_COLLECTION_PROPERTIES
The set of modifiable collection properties -
action
-
PROPERTY_PREFIX
Deprecated.
-
-
Constructor Details
-
CollectionAdminRequest
-
CollectionAdminRequest
-
-
Method Details
-
getParams
Description copied from class:SolrRequestThe parameters for this request; never null. The runtime type may be mutable but modifications may not affect thisSolrRequestinstance, as it may return a new instance here every time. If the subclass specifies the response type asModifiableSolrParams, then one can expect it to change this request. If the subclass has a setter then one can expect this method to return the value set.- Specified by:
getParamsin classSolrRequest<T extends CollectionAdminResponse>
-
addProperties
-
writeMap
Description copied from interface:MapWriterWrites this object's entries out toew.- Specified by:
writeMapin interfaceMapWriter- Throws:
IOException
-
toString
-
requiresCollection
public boolean requiresCollection()Description copied from class:SolrRequestDetermines whether this request should use or ignore any specified collections (esp.SolrClient.defaultCollection)Many Solr requests target a particular core or collection. But not all of them - many Solr APIs (e.g. security or other admin APIs) are agnostic of collections entirely. This method gives these requests a way to opt out of using
SolrClient.defaultCollectionor other specified collections.- Overrides:
requiresCollectionin classSolrRequest<T extends CollectionAdminResponse>
-
propagateBasicAuthCreds
protected <T extends CollectionAdminRequest<? extends CollectionAdminResponse>> T propagateBasicAuthCreds(T req) Take the request specific basic auth creds on this admin request and propagate them to a related request if does not already have credentials set, such as a CollectionAdminRequest.RequestStatus when doing async requests. -
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.NRTreplicasnumTlogReplicas- the number ofReplica.Type.TLOGreplicasnumPullReplicas- the number ofReplica.Type.PULLreplicas
-
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 configSetThis 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.NRTnumTlogReplicas- the number of replicas of typeReplica.Type.TLOGnumPullReplicas- 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
Returns a SolrRequest to reload a collection -
renameCollection
-
deleteNode
Returns a SolrRequest to delete a node. -
moveReplica
public static CollectionAdminRequest.MoveReplica moveReplica(String collection, String replica, String targetNode) -
rebalanceLeaders
-
reindexCollection
Returns a SolrRequest to reindex a collection -
collectionStatus
Return a SolrRequest for low-level detailed status of the specified collection.- Parameters:
collection- the collection to get the status of.
-
collectionStatuses
Return a SolrRequest for low-level detailed status of all collections on the cluster. -
deleteCollection
Returns a SolrRequest to delete a collection -
backupCollection
-
restoreCollection
public static CollectionAdminRequest.Restore restoreCollection(String collection, String backupName) -
installDataToShard
public static CollectionAdminRequest.InstallShard installDataToShard(String collection, String shard, String location, String backupRepository) Install index data to a specific shard of a specific collection- Parameters:
collection- the collection to install data toshard- the specific shard within to install data tolocation- a URI-string pointing to location of the index data within a particular backup repositorybackupRepository- the backup repository to lookup and install the index data from
-
installDataToShard
public static CollectionAdminRequest.InstallShard installDataToShard(String collection, String shard, String location) Install index data to a specific shard of a specific collectionWill use Solr's "default" backup repository for locating and accessing the index data.
- Parameters:
collection- the collection to install data toshard- the specific shard within to install data tolocation- a URI-string pointing to location of the index data within a particular backup repository
-
createShard
Returns a SolrRequest to create a new shard in a collection -
mockCollTask
Returns a SolrRequest to run a mock task. For tests only. -
splitShard
Returns a SolrRequest to split a shard in a collection -
deleteShard
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 collectionWARNING: 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
Returns a SolrRequest for checking the status of an asynchronous request- See Also:
-
waitForAsyncRequest
public static void waitForAsyncRequest(String requestId, SolrClient client, long timeout) throws SolrServerException, InterruptedException, IOException -
deleteAsyncId
Returns a SolrRequest to delete an asynchronous request status -
deleteAllAsyncIds
Returns a SolrRequest to delete a all asynchronous request statuses -
setAliasProperty
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
Returns a SolrRequest to delete an alias -
addReplicaToShard
Returns a SolrRequest to add a replica of typeReplica.Type.NRTto 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
Returns a SolrRequest to add a role to a node -
removeRole
Returns a SolrRequest to remove a role from a node -
getOverseerStatus
Return a SolrRequest to get the Overseer status -
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:
IOExceptionSolrServerException
-
deleteBackupById
Configure aSolrRequestobject to delete a single backup-point by it's Backup ID.The created request object is only valid on backup locations that use the new "incremental" backup file-format introduced in Solr 8.9. It should not be used on locations holding "non-incremental" backups (those created prior to 8.9, or after 8.9 using the advanced "incremental=false" flag).
- Parameters:
backupName- the name of the backup that this request should delete a single backup-point from.backupId- the ID of the backup-point for this request to delete
-
deleteBackupByRecency
public static CollectionAdminRequest.DeleteBackup deleteBackupByRecency(String backupName, int numRecentBackupPointsToRetain) Create aSolrRequestobject to delete all backup-points after the most recent 'N'The created request object is only valid on backup locations that use the new "incremental" backup file-format introduced in Solr 8.9. It should not be used on locations holding "non-incremental" backups (those created prior to 8.9, or after 8.9 using the advanced "incremental=false" flag).
- Parameters:
backupName- the name of the backup that this request should delete backup-points from.numRecentBackupPointsToRetain- the number of "most-recent" backup-points to retain.
-
deleteBackupPurgeUnusedFiles
Create aSolrRequestobject to delete all unused-files at the backup location.The created request object is only valid on backup locations that use the new "incremental" backup file-format introduced in Solr 8.9. It should not be used on locations holding "non-incremental" backups (those created prior to 8.9, or after 8.9 using the advanced "incremental=false" flag).
- Parameters:
backupName- the name of the backup that this request should delete unused files from.
-
listBackup
Create aSolrRequestobject to list information about all backup points with the specified name.- Parameters:
backupName- the name of the backup that this request should list information about
-
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 -
balanceReplicaProperty
public static CollectionAdminRequest.BalanceShardUnique balanceReplicaProperty(String collection, String propertyName) Returns a SolrRequest to balance a replica property across the shards of a collection
-