Class ReindexCollectionCmd
- java.lang.Object
-
- org.apache.solr.cloud.api.collections.ReindexCollectionCmd
-
- All Implemented Interfaces:
CollApiCmds.CollectionApiCommand
public class ReindexCollectionCmd extends Object implements CollApiCmds.CollectionApiCommand
Reindex a collection, usually in order to change the index schema.WARNING: Reindexing is potentially a lossy operation - some indexed data that is not available as stored fields may be irretrievably lost, so users should use this command with caution, evaluating the potential impact by using different source and target collection names first, and preserving the source collection until the evaluation is complete.
Reindexing follows these steps:
- creates a temporary collection using the most recent schema of the source collection (or the one specified in the parameters, which must already exist), and the shape of the original collection, unless overridden by parameters.
- copy the source documents to the temporary collection, using their stored fields and reindexing them using the specified schema. NOTE: some data loss may occur if the original stored field data is not available!
- create the target collection from scratch with the specified name (or the same as source if not specified) and the specified parameters. NOTE: if the target name was not specified or is the same as the source collection then a unique sequential collection name will be used.
- copy the documents from the source collection to the target collection.
- if the source and target collection name was the same then set up an alias pointing from the source collection name to the actual (sequentially named) target collection
- optionally delete the source collection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReindexCollectionCmd.Cmd
static class
ReindexCollectionCmd.State
-
Field Summary
Fields Modifier and Type Field Description static String
CHK_COL_PREFIX
static String
COMMAND
static String
PHASE
static String
REINDEX_STATUS
static String
REINDEXING_STATE
static String
REMOVE_SOURCE
static String
STATE
static String
TARGET
static String
TARGET_COL_PREFIX
-
Constructor Summary
Constructors Constructor Description ReindexCollectionCmd(CollectionCommandContext ccc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
call(org.apache.solr.common.cloud.ClusterState clusterState, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results)
static Map<String,Object>
getReindexingState(org.apache.solr.client.solrj.cloud.DistribStateManager stateManager, String collection)
-
-
-
Field Detail
-
COMMAND
public static final String COMMAND
- See Also:
- Constant Field Values
-
REINDEX_STATUS
public static final String REINDEX_STATUS
- See Also:
- Constant Field Values
-
REMOVE_SOURCE
public static final String REMOVE_SOURCE
- See Also:
- Constant Field Values
-
TARGET
public static final String TARGET
- See Also:
- Constant Field Values
-
TARGET_COL_PREFIX
public static final String TARGET_COL_PREFIX
- See Also:
- Constant Field Values
-
CHK_COL_PREFIX
public static final String CHK_COL_PREFIX
- See Also:
- Constant Field Values
-
REINDEXING_STATE
public static final String REINDEXING_STATE
-
STATE
public static final String STATE
- See Also:
- Constant Field Values
-
PHASE
public static final String PHASE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReindexCollectionCmd
public ReindexCollectionCmd(CollectionCommandContext ccc)
-
-
Method Detail
-
call
public void call(org.apache.solr.common.cloud.ClusterState clusterState, org.apache.solr.common.cloud.ZkNodeProps message, org.apache.solr.common.util.NamedList<Object> results) throws Exception
- Specified by:
call
in interfaceCollApiCmds.CollectionApiCommand
- Throws:
Exception
-
-