class VitamElasticsearchRepository implements VitamRepository {

    @Override
    public Optional<Document> findByIdentifierAndTenant(String identifier, Integer tenant)
        throws DatabaseException {
        ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED, tenant);

        try {
            String index = indexName;
            if (indexByTenant) {
                index = index + "_" + tenant;
            }
            QueryBuilder qb = boolQuery().must(termQuery(IDENTIFIER, identifier))
                .must(termQuery(VitamDocument.TENANT_ID, tenant));

            return handleSearch(index, qb);
        } catch (IOException e) {
            throw new DatabaseException("Search by identifier and tenant exception", e);
        }

    }

    public  VitamElasticsearchRepository(RestHighLevelClient client, String indexName, boolean indexByTenant);

}