Package fr.gouv.vitam.common.database.server.elasticsearch

# Class IndexationHelper

java.lang.Object
fr.gouv.vitam.common.database.server.elasticsearch.IndexationHelper

public class IndexationHelper extends Object
IndexationHelper useful method for indexation

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IndexationHelper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ReindexationResult`
  `getFullKOResult(IndexParameters indexParameters, String message)`
  Get KO Result for reindexation orders
  `static IndexationHelper`
  `getInstance()`
  `SwitchIndexResult`
  `getKOResult(SwitchIndexParameters switchIndexParameters, String message)`
  Get KO Result for switching order
  `ReindexationOK`
  `reindex(com.mongodb.client.MongoCollection<org.bson.Document> collection, ElasticsearchAccess esClient, ElasticsearchIndexAlias indexAlias, ElasticsearchIndexSettings indexSettings, ElasticsearchCollections elasticsearchCollection, List<Integer> tenantIds, String tenantGroupName, String elasticsearchConfigurationFilePath)`
  reindex a collection on a tenant list with a esmapping file
  `SwitchIndexResult`
  `switchIndex(ElasticsearchIndexAlias indexAlias, ElasticsearchIndexAlias newIndex, ElasticsearchAccess esClient)`
  switch index, attach a new index to an existing alias

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### IndexationHelper

    public IndexationHelper()

- ## Method Details

  - ### getInstance

    public static IndexationHelper getInstance()

  - ### reindex

    public ReindexationOK reindex(com.mongodb.client.MongoCollection<org.bson.Document> collection, ElasticsearchAccess esClient, ElasticsearchIndexAlias indexAlias, ElasticsearchIndexSettings indexSettings, ElasticsearchCollections elasticsearchCollection, List<Integer> tenantIds, String tenantGroupName, String elasticsearchConfigurationFilePath) throws DatabaseException
    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
      `indexAlias` - the elastic index alias information
    Returns:
      the result of the reindexation as a IndexationResult object
    Throws:
      `DatabaseException`

  - ### switchIndex

    public SwitchIndexResult switchIndex(ElasticsearchIndexAlias indexAlias, ElasticsearchIndexAlias newIndex, ElasticsearchAccess esClient) throws DatabaseException
    switch index, attach a new index to an existing alias
    Parameters:
      `indexAlias` - the alias information
      `newIndex` - the new index name to switch on
      `esClient` - the elastic client
    Throws:
      `DatabaseException` - if an error occurs

  - ### getFullKOResult

    public ReindexationResult getFullKOResult(IndexParameters indexParameters, 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 SwitchIndexResult getKOResult(SwitchIndexParameters switchIndexParameters, 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