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(java.lang.String clusterName, java.util.List<ElasticsearchNode> nodes, ElasticsearchMetadataIndexManager indexManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.elasticsearch.action.search.SearchResponse
basicSearch(MetadataCollections collection, java.lang.Integer tenantId, java.util.List<org.elasticsearch.search.aggregations.AggregationBuilder> aggregations, org.elasticsearch.index.query.QueryBuilder query)
Makes a search request on elasticsearch on a collection with aggregations and a queryvoid
createIndexAndAliasIfAliasNotExists(MetadataCollections collection, java.lang.Integer tenantId)
void
createIndexesAndAliases(MetadataCollections objectCollection, MetadataCollections unitCollection)
void
delete(MetadataCollections collection, java.util.List<java.lang.String> ids, java.lang.Integer tenantId)
void
deleteBulkOGEntriesIndexes(java.util.List<java.lang.String> ids, java.lang.Integer tenantId)
void
deleteBulkUnitsEntriesIndexes(java.util.List<java.lang.String> ids, java.lang.Integer tenantId)
void
deleteIndexByAliasForTesting(MetadataCollections collection, int tenantId)
void
indexEntry(MetadataCollections collection, java.lang.Integer tenantId, java.lang.String id, VitamDocument<?> vitamDocument)
void
insertFullDocument(MetadataCollections collection, java.lang.Integer tenantId, java.lang.String id, MetadataDocument<?> doc)
Insert one elementvoid
insertFullDocuments(MetadataCollections collection, java.lang.Integer tenantId, java.util.Collection<? extends MetadataDocument<?>> documents)
void
purgeIndexForTesting(MetadataCollections collection, java.lang.Integer tenantId)
void
refreshIndex(MetadataCollections collection, int tenantId)
protected Result<MetadataDocument<?>>
search(MetadataCollections collection, java.lang.Integer tenantId, org.elasticsearch.index.query.QueryBuilder query, java.util.List<org.elasticsearch.search.sort.SortBuilder<?>> sorts, int offset, java.lang.Integer limit, java.util.List<org.elasticsearch.search.aggregations.AggregationBuilder> facets, java.lang.String scrollId, java.lang.Integer scrollTimeout, boolean trackTotalHits)
void
updateFullDocument(MetadataCollections collection, java.lang.Integer tenantId, java.lang.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
-
-
-
-
Constructor Detail
-
ElasticsearchAccessMetadata
public ElasticsearchAccessMetadata(java.lang.String clusterName, java.util.List<ElasticsearchNode> nodes, ElasticsearchMetadataIndexManager indexManager) throws VitamException
- Parameters:
clusterName
- cluster namenodes
- list of elasticsearch nodeindexManager
-- Throws:
VitamException
- if nodes list is empty
-
-
Method Detail
-
createIndexesAndAliases
public void createIndexesAndAliases(MetadataCollections objectCollection, MetadataCollections unitCollection)
-
createIndexAndAliasIfAliasNotExists
public final void createIndexAndAliasIfAliasNotExists(MetadataCollections collection, java.lang.Integer tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
search
protected final Result<MetadataDocument<?>> search(MetadataCollections collection, java.lang.Integer tenantId, org.elasticsearch.index.query.QueryBuilder query, java.util.List<org.elasticsearch.search.sort.SortBuilder<?>> sorts, int offset, java.lang.Integer limit, java.util.List<org.elasticsearch.search.aggregations.AggregationBuilder> facets, java.lang.String scrollId, java.lang.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 sortfacets
- the list of facet- Returns:
- a structure as ResultInterface
- Throws:
MetaDataExecutionException
BadRequestException
-
basicSearch
public org.elasticsearch.action.search.SearchResponse basicSearch(MetadataCollections collection, java.lang.Integer tenantId, java.util.List<org.elasticsearch.search.aggregations.AggregationBuilder> aggregations, org.elasticsearch.index.query.QueryBuilder query) throws MetaDataExecutionException
Makes a search request on elasticsearch on a collection with aggregations and a query- Parameters:
collection
- on which the request is madetenantId
- on which the request is madeaggregations
- elasticsearchquery
- elasticsearch- Returns:
- the elasticsearch SearchResponse
- Throws:
MetaDataExecutionException
-
insertFullDocument
public void insertFullDocument(MetadataCollections collection, java.lang.Integer tenantId, java.lang.String id, MetadataDocument<?> doc) throws MetaDataExecutionException
Insert one element- Parameters:
collection
-tenantId
-id
-doc
- full document to insert- Throws:
MetaDataExecutionException
-
insertFullDocuments
public void insertFullDocuments(MetadataCollections collection, java.lang.Integer tenantId, java.util.Collection<? extends MetadataDocument<?>> documents) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
updateFullDocument
public void updateFullDocument(MetadataCollections collection, java.lang.Integer tenantId, java.lang.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(java.util.List<java.lang.String> ids, java.lang.Integer tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
deleteBulkUnitsEntriesIndexes
public void deleteBulkUnitsEntriesIndexes(java.util.List<java.lang.String> ids, java.lang.Integer tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
refreshIndex
public void refreshIndex(MetadataCollections collection, int tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
indexEntry
public void indexEntry(MetadataCollections collection, java.lang.Integer tenantId, java.lang.String id, VitamDocument<?> vitamDocument) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
purgeIndexForTesting
public void purgeIndexForTesting(MetadataCollections collection, java.lang.Integer tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
deleteIndexByAliasForTesting
public void deleteIndexByAliasForTesting(MetadataCollections collection, int tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
delete
public void delete(MetadataCollections collection, java.util.List<java.lang.String> ids, java.lang.Integer tenantId) throws MetaDataExecutionException
- Throws:
MetaDataExecutionException
-
-