Class IndexationHelper
- java.lang.Object
-
- fr.gouv.vitam.common.database.server.elasticsearch.IndexationHelper
-
public class IndexationHelper extends java.lang.ObjectIndexationHelper useful method for indexation
-
-
Constructor Summary
Constructors Constructor Description IndexationHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexationResultgetFullKOResult(IndexParameters indexParameters, java.lang.String message)Get KO Result for reindexation ordersstatic IndexationHelpergetInstance()IndexationResultgetKOResult(SwitchIndexParameters switchIndexParameters, java.lang.String message)Get KO Result for switching orderIndexationResultreindex(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)reindex a collection on a tenant list with a esmapping filevoidswitchIndex(java.lang.String aliasName, java.lang.String newIndex, ElasticsearchAccess esClient)switch index, attach a new index to an existing alias
-
-
-
Method Detail
-
getInstance
public static IndexationHelper getInstance()
-
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 reindexedesClient- the elastic client to be used to reindextenants- the tenant list on which to reindexmapping- 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 DatabaseExceptionswitch index, attach a new index to an existing alias- Parameters:
aliasName- the name of the aliasnewIndex- the new index name to switch onesClient- 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 parametermessage- 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 parametermessage- the message to be added- Returns:
- the final result as an IndexationResult object
-
-