Package fr.gouv.vitam.common.database.api.impl

# Class VitamElasticsearchRepository

java.lang.Object
fr.gouv.vitam.common.database.api.impl.VitamElasticsearchRepository

public class VitamElasticsearchRepository extends Object
Implementation for Elasticsearch

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ID`
  `static final String`
  `IDENTIFIER`
  Identifier

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VitamElasticsearchRepository(co.elastic.clients.elasticsearch.ElasticsearchClient client, ElasticsearchIndexAliasResolver elasticsearchIndexAliasResolver)`
  VitamElasticsearchRepository Constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `delete(List<String> ids, int tenant)`
  `Optional<org.bson.Document>`
  `findByIdentifier(String identifier)`
  `Optional<org.bson.Document>`
  `findByIdentifierAndTenant(String identifier, Integer tenant)`
  `Optional<org.bson.Document>`
  `getByID(String id, Integer tenant)`
  `Optional<org.bson.Document>`
  `getDocumentByIdCrossIndices(String id)`
  WARNING: Query all indices.
  `long`
  `purge()`
  `long`
  `purge(Integer tenant)`
  `void`
  `remove(String id, Integer tenant)`
  `void`
  `save(ElasticsearchCollections elasticsearchCollections, List<org.bson.Document> documents)`
  `void`
  `save(List<org.bson.Document> documents)`
  `VitamRepositoryStatus`
  `save(org.bson.Document document)`
  `co.elastic.clients.elasticsearch.core.SearchResponse<org.bson.Document>`
  `search(String index, co.elastic.clients.elasticsearch._types.query_dsl.Query qb)`

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

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

- ## Field Details

  - ### IDENTIFIER

    public static final String IDENTIFIER
    Identifier
    See Also:
      - Constant Field Values

  - ### ID

    public static final String ID
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### VitamElasticsearchRepository

    public VitamElasticsearchRepository(co.elastic.clients.elasticsearch.ElasticsearchClient client, ElasticsearchIndexAliasResolver elasticsearchIndexAliasResolver)
    VitamElasticsearchRepository Constructor
    Parameters:
      `client` - the es client
      `elasticsearchIndexAliasResolver` - the name of the index

- ## Method Details

  - ### save

    public VitamRepositoryStatus save(org.bson.Document document) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### save

    public void save(List<org.bson.Document> documents) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### save

    public void save(ElasticsearchCollections elasticsearchCollections, List<org.bson.Document> documents) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### remove

    public void remove(String id, Integer tenant) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### purge

    public long purge(Integer tenant) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### purge

    public long purge() throws DatabaseException
    Throws:
      `DatabaseException`

  - ### getByID

    public Optional<org.bson.Document> getByID(String id, Integer tenant) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### getDocumentByIdCrossIndices

    public Optional<org.bson.Document> getDocumentByIdCrossIndices(String id) throws DatabaseException
    WARNING: Query all indices. Use with caution!
    Throws:
      `DatabaseException`

  - ### findByIdentifierAndTenant

    public Optional<org.bson.Document> findByIdentifierAndTenant(String identifier, Integer tenant) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### search

    public co.elastic.clients.elasticsearch.core.SearchResponse<org.bson.Document> search(String index, co.elastic.clients.elasticsearch._types.query_dsl.Query qb) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### findByIdentifier

    public Optional<org.bson.Document> findByIdentifier(String identifier) throws DatabaseException
    Throws:
      `DatabaseException`

  - ### delete

    public void delete(List<String> ids, int tenant) throws DatabaseException
    Throws:
      `DatabaseException`