Class IndexationHelper


  • public class IndexationHelper
    extends java.lang.Object
    IndexationHelper useful method for indexation
    • Constructor Detail

      • IndexationHelper

        public IndexationHelper()
    • Method Detail

      • reindex

        public IndexationResult reindex​(com.mongodb.client.MongoCollection<org.bson.Document> collection,
                                        java.lang.String collectionName,
                                        ElasticsearchAccess esClient,
                                        java.util.List<java.lang.Integer> tenants,
                                        java.io.InputStream mapping)
                                 throws java.io.IOException
        reindex a collection on a tenant list with a esmapping file
        Parameters:
        collection - the collection to be reindexed
        esClient - the elastic client to be used to reindex
        tenants - the tenant list on which to reindex
        mapping - the es mapping as a string
        Returns:
        the result of the reindexation as a IndexationResult object
        Throws:
        java.io.IOException
      • switchIndex

        public void switchIndex​(java.lang.String aliasName,
                                java.lang.String newIndex,
                                ElasticsearchAccess esClient)
                         throws DatabaseException
        switch index, attach a new index to an existing alias
        Parameters:
        aliasName - the name of the alias
        newIndex - the new index name to switch on
        esClient - the elastic client
        Throws:
        DatabaseException - if an error occurs
      • getFullKOResult

        public IndexationResult getFullKOResult​(IndexParameters indexParameters,
                                                java.lang.String message)
        Get KO Result for reindexation orders
        Parameters:
        indexParameters - the index parameter
        message - the message to be added
        Returns:
        the final result as an IndexationResult object
      • getKOResult

        public IndexationResult getKOResult​(SwitchIndexParameters switchIndexParameters,
                                            java.lang.String message)
        Get KO Result for switching order
        Parameters:
        switchIndexParameters - the switch index parameter
        message - the message to be added
        Returns:
        the final result as an IndexationResult object