Package fr.gouv.vitam.metadata.core.database.collections

# Class ElasticsearchAccessMetadata

java.lang.Object
fr.gouv.vitam.common.database.server.elasticsearch.ElasticsearchAccess
fr.gouv.vitam.metadata.core.database.collections.ElasticsearchAccessMetadata

All Implemented Interfaces:
  `DatabaseConnection`

public class ElasticsearchAccessMetadata extends ElasticsearchAccess
ElasticSearch model with MongoDB as main database

- ## Field Summary

  ### Fields inherited from class fr.gouv.vitam.common.database.server.elasticsearch.ElasticsearchAccess

  `clusterName, DEFAULT_LIMIT_SCROLL, DEFAULT_SCROLL_TIMEOUT, nodes, SCROLL_ACTIVATE_KEYWORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ElasticsearchAccessMetadata(String clusterName, List<ElasticsearchNode> nodes, ElasticsearchMetadataIndexManager indexManager)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregate>`
  `basicAggregationSearch(MetadataCollections collection, Integer tenantId, Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregation> aggregations, co.elastic.clients.elasticsearch._types.query_dsl.Query query)`
  Makes a search request on elasticsearch on a collection with aggregations and a query
  `final void`
  `createIndexAndAliasIfAliasNotExists(MetadataCollections collection, Integer tenantId)`
  `void`
  `createIndexesAndAliases(MetadataCollections... collections)`
  `void`
  `delete(MetadataCollections collection, List<String> ids, Integer tenantId)`
  `void`
  `deleteBulkOGEntriesIndexes(List<String> ids, Integer tenantId)`
  `void`
  `deleteBulkUnitsEntriesIndexes(List<String> ids, Integer tenantId)`
  `void`
  `deleteIndexByAliasForTesting(MetadataCollections collection, int tenantId)`
  `void`
  `indexEntry(MetadataCollections collection, Integer tenantId, String id, VitamDocument<?> vitamDocument)`
  `void`
  `insertFullDocument(MetadataCollections collection, Integer tenantId, String id, MetadataDocument<?> doc)`
  Insert one element
  `void`
  `insertFullDocuments(MetadataCollections collection, Integer tenantId, Collection<? extends MetadataDocument<?>> documents)`
  `void`
  `insertFullDocumentsWithRefreshSettings(MetadataCollections collection, Integer tenantId, Collection<? extends MetadataDocument<?>> documents, boolean withRefreshIndex)`
  `void`
  `purgeIndexForTesting(MetadataCollections collection, Integer tenantId)`
  `void`
  `refreshIndex(MetadataCollections collection, int tenantId)`
  `protected final Result<MetadataDocument<?>>`
  `search(MetadataCollections collection, Integer tenantId, co.elastic.clients.elasticsearch._types.query_dsl.Query query, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, Integer limit, Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, boolean trackTotalHits)`
  `void`
  `updateFullDocument(MetadataCollections collection, Integer tenantId, String id, MetadataDocument<?> metadataDocument)`
  Update one element fully

  ### Methods inherited from class fr.gouv.vitam.common.database.server.elasticsearch.ElasticsearchAccess

  `checkConnection, clearScroll, close, createIndexAndAliasIfAliasNotExists, createIndexWithoutAlias, delete, deleteIndexByAliasForTesting, deleteIndexForTesting, existsAlias, existsIndex, getAlias, getClient, getClusterName, getInfo, getNodes, indexEntries, indexEntry, purgeIndexForTesting, purgeIndexForTesting, refreshIndex, search, search, searchCrossIndices, switchIndex, updateEntry`

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

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

- ## Constructor Details

  - ### ElasticsearchAccessMetadata

    public ElasticsearchAccessMetadata(String clusterName, List<ElasticsearchNode> nodes, ElasticsearchMetadataIndexManager indexManager) throws VitamException
    Parameters:
      `clusterName` - cluster name
      `nodes` - list of elasticsearch node
      `indexManager` -
    Throws:
      `VitamException` - if nodes list is empty

- ## Method Details

  - ### createIndexesAndAliases

    public void createIndexesAndAliases(MetadataCollections... collections)

  - ### createIndexAndAliasIfAliasNotExists

    public final void createIndexAndAliasIfAliasNotExists(MetadataCollections collection, Integer tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### search

    protected final Result<MetadataDocument<?>> search(MetadataCollections collection, Integer tenantId, co.elastic.clients.elasticsearch._types.query_dsl.Query query, List<co.elastic.clients.elasticsearch._types.SortOptions> sorts, int offset, Integer limit, Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregation> facets, String scrollId, Integer scrollTimeout, boolean trackTotalHits) throws MetaDataExecutionException, BadRequestException
    Parameters:
      `collection` -
      `tenantId` -
      `query` - as in DSL mode "{ "fieldname" : "value" }" "{ "match" : { "fieldname" : "value" } }" "{ "ids" : { " values" : [list of id] } }"
      `sorts` - the list of sort
      `facets` - the list of facet
    Returns:
      a structure as ResultInterface
    Throws:
      `MetaDataExecutionException`
      `BadRequestException`

  - ### basicAggregationSearch

    public Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregate> basicAggregationSearch(MetadataCollections collection, Integer tenantId, Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregation> aggregations, co.elastic.clients.elasticsearch._types.query_dsl.Query query) throws MetaDataExecutionException
    Makes a search request on elasticsearch on a collection with aggregations and a query
    Parameters:
      `collection` - on which the request is made
      `tenantId` - on which the request is made
      `aggregations` - elasticsearch
      `query` - elasticsearch
    Returns:
      the elasticsearch SearchResponse
    Throws:
      `MetaDataExecutionException`

  - ### insertFullDocument

    public void insertFullDocument(MetadataCollections collection, Integer tenantId, String id, MetadataDocument<?> doc) throws MetaDataExecutionException
    Insert one element
    Parameters:
      `collection` -
      `tenantId` -
      `id` -
      `doc` - full document to insert
    Throws:
      `MetaDataExecutionException`

  - ### insertFullDocumentsWithRefreshSettings

    public void insertFullDocumentsWithRefreshSettings(MetadataCollections collection, Integer tenantId, Collection<? extends MetadataDocument<?>> documents, boolean withRefreshIndex) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### insertFullDocuments

    public void insertFullDocuments(MetadataCollections collection, Integer tenantId, Collection<? extends MetadataDocument<?>> documents) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### updateFullDocument

    public void updateFullDocument(MetadataCollections collection, Integer tenantId, String id, MetadataDocument<?> metadataDocument) throws MetaDataExecutionException
    Update one element fully
    Parameters:
      `collection` -
      `tenantId` -
      `id` -
      `metadataDocument` - full document to update
    Throws:
      `MetaDataExecutionException`

  - ### deleteBulkOGEntriesIndexes

    public void deleteBulkOGEntriesIndexes(List<String> ids, Integer tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### deleteBulkUnitsEntriesIndexes

    public void deleteBulkUnitsEntriesIndexes(List<String> ids, Integer tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### refreshIndex

    public void refreshIndex(MetadataCollections collection, int tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### indexEntry

    public void indexEntry(MetadataCollections collection, Integer tenantId, String id, VitamDocument<?> vitamDocument) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### purgeIndexForTesting

    public void purgeIndexForTesting(MetadataCollections collection, Integer tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### deleteIndexByAliasForTesting

    public void deleteIndexByAliasForTesting(MetadataCollections collection, int tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`

  - ### delete

    public void delete(MetadataCollections collection, List<String> ids, Integer tenantId) throws MetaDataExecutionException
    Throws:
      `MetaDataExecutionException`