Class ReindexCollectionCmd

  • All Implemented Interfaces:

    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:

    1. 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.
    2. 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!
    3. 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.
    4. copy the documents from the source collection to the target collection.
    5. 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
    6. optionally delete the source collection.