From f392bf9ab371a4c0c088b3e167679ceece9982fb Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Mon, 2 Sep 2024 17:16:23 +0200 Subject: [PATCH] Replace Elasticsearch by OpenSearch The change was prepared with these commands: `` perl -pi -e s/org.elasticsearch/org.opensearch/g $(git grep -l org.elasticsearch) perl -pi -e s/ElasticsearchStatusException/OpenSearchStatusException/g $(git grep -l ElasticsearchStatusException) ``` Signed-off-by: Stefan Weil --- Kitodo-DataManagement/pom.xml | 24 +++++++++--- .../data/elasticsearch/KitodoRestClient.java | 20 +++++----- .../elasticsearch/index/IndexRestClient.java | 20 +++++----- .../elasticsearch/index/ResponseListener.java | 4 +- .../search/SearchRestClient.java | 36 +++++++++--------- .../data/elasticsearch/search/Searcher.java | 14 +++---- .../data/elasticsearch/ExtendedNode.java | 8 ++-- .../kitodo/data/elasticsearch/MockEntity.java | 6 +-- .../index/IndexRestClientIT.java | 2 +- .../search/SearchRestClientIT.java | 6 +-- .../data/elasticsearch/search/SearcherIT.java | 20 +++++----- Kitodo/pom.xml | 8 +++- .../kitodo/production/forms/BatchForm.java | 6 +-- .../kitodo/production/forms/DesktopForm.java | 4 +- .../helper/SearchResultGeneration.java | 6 +-- .../kitodo/production/model/LazyDTOModel.java | 6 +-- .../production/model/LazyProcessDTOModel.java | 6 +-- .../production/model/LazyTaskDTOModel.java | 6 +-- .../services/data/BatchService.java | 6 +-- .../services/data/DocketService.java | 6 +-- .../services/data/FilterService.java | 8 ++-- .../services/data/ProcessService.java | 26 ++++++------- .../services/data/ProjectService.java | 8 ++-- .../services/data/RulesetService.java | 6 +-- .../production/services/data/TaskService.java | 6 +-- .../services/data/TemplateService.java | 4 +- .../services/data/WorkflowService.java | 4 +- .../data/base/ClientSearchService.java | 10 ++--- .../data/base/ProjectSearchService.java | 6 +-- .../services/data/base/SearchService.java | 36 +++++++++--------- .../data/base/TitleSearchService.java | 10 ++--- .../test/java/org/kitodo/MockDatabase.java | 10 ++--- .../services/data/BatchServiceIT.java | 6 +-- .../services/data/DocketServiceIT.java | 6 +-- .../services/data/FilterServiceIT.java | 14 +++---- .../services/data/ProcessServiceIT.java | 6 +-- .../services/data/ProjectServiceIT.java | 6 +-- .../services/data/RulesetServiceIT.java | 6 +-- pom.xml | 38 +++++++++---------- 39 files changed, 223 insertions(+), 207 deletions(-) diff --git a/Kitodo-DataManagement/pom.xml b/Kitodo-DataManagement/pom.xml index f8fc427c5e1..35884307cde 100644 --- a/Kitodo-DataManagement/pom.xml +++ b/Kitodo-DataManagement/pom.xml @@ -72,8 +72,24 @@ myfaces-impl - org.elasticsearch.client - elasticsearch-rest-high-level-client + org.opensearch + opensearch + + + org.opensearch + opensearch-core + + + org.opensearch.client + opensearch-rest-client + + + org.opensearch.client + opensearch-rest-high-level-client + + + org.opensearch.plugin + transport-netty4-client org.glassfish @@ -119,10 +135,6 @@ org.junit.jupiter junit-jupiter-engine - - org.elasticsearch.plugin - transport-netty4-client - diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java index 85f16896dd2..667e08be3dd 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/KitodoRestClient.java @@ -30,19 +30,19 @@ import org.apache.http.util.EntityUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.Requests; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.ResponseException; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.RestClientBuilder; -import org.elasticsearch.client.RestHighLevelClient; -import org.elasticsearch.client.core.MainResponse; -import org.elasticsearch.rest.RestStatus; import org.kitodo.config.ConfigMain; import org.kitodo.data.elasticsearch.api.RestClientInterface; import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; +import org.opensearch.client.Request; +import org.opensearch.client.RequestOptions; +import org.opensearch.client.Requests; +import org.opensearch.client.Response; +import org.opensearch.client.ResponseException; +import org.opensearch.client.RestClient; +import org.opensearch.client.RestClientBuilder; +import org.opensearch.client.RestHighLevelClient; +import org.opensearch.client.core.MainResponse; +import org.opensearch.core.rest.RestStatus; /** * Implementation of ElasticSearch REST Client for Index Module. diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/IndexRestClient.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/IndexRestClient.java index c6e0b7f2460..51b66b590b8 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/IndexRestClient.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/IndexRestClient.java @@ -20,19 +20,19 @@ import org.apache.http.HttpEntity; import org.apache.http.entity.ContentType; import org.apache.http.nio.entity.NStringEntity; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.ResponseException; import org.kitodo.data.elasticsearch.KitodoRestClient; import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; import org.kitodo.data.exceptions.DataException; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Request; +import org.opensearch.client.RequestOptions; +import org.opensearch.client.Response; +import org.opensearch.client.ResponseException; /** * Implementation of ElasticSearch REST Client for index package. diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/ResponseListener.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/ResponseListener.java index a7f69fb3759..419b55ce2e4 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/ResponseListener.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/index/ResponseListener.java @@ -13,8 +13,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.bulk.BulkResponse; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.core.action.ActionListener; public class ResponseListener implements ActionListener { diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/SearchRestClient.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/SearchRestClient.java index 4893747dc03..544cff5effa 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/SearchRestClient.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/SearchRestClient.java @@ -25,27 +25,27 @@ import org.apache.http.entity.ContentType; import org.apache.http.nio.entity.NStringEntity; import org.apache.http.util.EntityUtils; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequest; -import org.elasticsearch.action.get.MultiGetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.ResponseException; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.FetchSourceContext; -import org.elasticsearch.search.sort.SortBuilder; import org.kitodo.data.elasticsearch.KitodoRestClient; import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; import org.kitodo.data.exceptions.DataException; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.get.MultiGetItemResponse; +import org.opensearch.action.get.MultiGetRequest; +import org.opensearch.action.get.MultiGetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.Request; +import org.opensearch.client.RequestOptions; +import org.opensearch.client.Response; +import org.opensearch.client.ResponseException; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.SearchHits; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.Aggregations; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.search.fetch.subphase.FetchSourceContext; +import org.opensearch.search.sort.SortBuilder; /** * Extension of KitodoRestClient for search package. diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/Searcher.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/Searcher.java index c3e99897a31..5b7233f61d9 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/Searcher.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/elasticsearch/search/Searcher.java @@ -22,16 +22,16 @@ import javax.json.JsonObject; import javax.json.JsonReader; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.sort.SortBuilder; import org.kitodo.data.elasticsearch.Index; import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; import org.kitodo.data.exceptions.DataException; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.search.SearchHit; +import org.opensearch.search.SearchHits; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.Aggregations; +import org.opensearch.search.sort.SortBuilder; /** * Implementation of ElasticSearch Searcher for Kitodo - Data Management diff --git a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/ExtendedNode.java b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/ExtendedNode.java index 7cdfebe5e4b..4c18d02bfae 100644 --- a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/ExtendedNode.java +++ b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/ExtendedNode.java @@ -16,10 +16,10 @@ import java.util.Collections; import java.util.function.Supplier; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.InternalSettingsPreparer; -import org.elasticsearch.node.Node; -import org.elasticsearch.plugins.Plugin; +import org.opensearch.common.settings.Settings; +import org.opensearch.node.InternalSettingsPreparer; +import org.opensearch.node.Node; +import org.opensearch.plugins.Plugin; /** * Class extends standard Node class to give possibility for using own REST diff --git a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/MockEntity.java b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/MockEntity.java index c59b7a1ba56..80c2db53489 100644 --- a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/MockEntity.java +++ b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/MockEntity.java @@ -24,10 +24,10 @@ import org.apache.commons.io.FileUtils; import org.awaitility.Awaitility; import org.awaitility.Durations; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.Node; -import org.elasticsearch.transport.Netty4Plugin; import org.kitodo.config.ConfigMain; +import org.opensearch.common.settings.Settings; +import org.opensearch.node.Node; +import org.opensearch.transport.Netty4Plugin; /** diff --git a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/index/IndexRestClientIT.java b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/index/IndexRestClientIT.java index 43c47660b4f..26652071010 100644 --- a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/index/IndexRestClientIT.java +++ b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/index/IndexRestClientIT.java @@ -16,7 +16,7 @@ import java.util.Map; -import org.elasticsearch.node.Node; +import org.opensearch.node.Node; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; diff --git a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearchRestClientIT.java b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearchRestClientIT.java index a405300f30e..f84082ffe64 100644 --- a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearchRestClientIT.java +++ b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearchRestClientIT.java @@ -16,9 +16,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.node.Node; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.node.Node; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearcherIT.java b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearcherIT.java index 3e7ca378274..4da3470c8b0 100644 --- a/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearcherIT.java +++ b/Kitodo-DataManagement/src/test/java/org/kitodo/data/elasticsearch/search/SearcherIT.java @@ -17,16 +17,16 @@ import java.util.Map; import java.util.Objects; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.node.Node; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.metrics.Sum; -import org.elasticsearch.search.aggregations.metrics.ValueCount; -import org.elasticsearch.search.sort.FieldSortBuilder; -import org.elasticsearch.search.sort.SortBuilder; -import org.elasticsearch.search.sort.SortOrder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.node.Node; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.metrics.Sum; +import org.opensearch.search.aggregations.metrics.ValueCount; +import org.opensearch.search.sort.FieldSortBuilder; +import org.opensearch.search.sort.SortBuilder; +import org.opensearch.search.sort.SortOrder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/Kitodo/pom.xml b/Kitodo/pom.xml index da974cb8e30..6fb18b1a3c5 100644 --- a/Kitodo/pom.xml +++ b/Kitodo/pom.xml @@ -182,8 +182,12 @@ avalon-framework-impl - org.elasticsearch.client - transport + org.opensearch + opensearch + + + org.opensearch.plugin + transport-netty4-client org.jdom diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java index 8a960682f72..13035ef17c1 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java @@ -24,9 +24,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.sort.SortOrder; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; import org.kitodo.data.database.beans.Batch; @@ -42,6 +39,9 @@ import org.kitodo.production.helper.batch.BatchProcessHelper; import org.kitodo.production.model.LazyDTOModel; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.sort.SortOrder; @Named("BatchForm") @ViewScoped diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/DesktopForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/DesktopForm.java index 1e056073113..f049aa69de6 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/DesktopForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/DesktopForm.java @@ -22,7 +22,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; import org.kitodo.data.database.exceptions.DAOException; import org.kitodo.data.exceptions.DataException; import org.kitodo.exceptions.ProjectDeletionException; @@ -35,6 +34,7 @@ import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.ProcessService; import org.kitodo.production.services.data.ProjectService; +import org.opensearch.OpenSearchStatusException; import org.primefaces.model.SortOrder; @Named("DesktopForm") @@ -213,7 +213,7 @@ public long getNumberOfElements(ObjectType objectType) { return 0L; } - } catch (DAOException | JsonException | ElasticsearchStatusException e) { + } catch (DAOException | JsonException | OpenSearchStatusException e) { Helper.setErrorMessage("Unable to load number of elements", logger, e); } return 0L; diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java index 34a9acd64ef..78df92c492d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java @@ -19,14 +19,14 @@ import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.search.sort.SortOrder; import org.kitodo.data.elasticsearch.index.type.enums.ProcessTypeField; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.dto.ProcessDTO; import org.kitodo.production.enums.ObjectType; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.RangeQueryBuilder; +import org.opensearch.search.sort.SortOrder; public class SearchResultGeneration { diff --git a/Kitodo/src/main/java/org/kitodo/production/model/LazyDTOModel.java b/Kitodo/src/main/java/org/kitodo/production/model/LazyDTOModel.java index 791a8268cc9..915ca3ddc32 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/LazyDTOModel.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/LazyDTOModel.java @@ -23,8 +23,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.index.query.QueryShardException; import org.hibernate.exception.SQLGrammarException; import org.kitodo.config.ConfigMain; import org.kitodo.data.database.beans.BaseBean; @@ -36,6 +34,8 @@ import org.kitodo.production.dto.BaseDTO; import org.kitodo.production.services.data.FilterService; import org.kitodo.production.services.data.base.SearchDatabaseService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.index.query.QueryShardException; import org.primefaces.PrimeFaces; import org.primefaces.model.FilterMeta; import org.primefaces.model.LazyDataModel; @@ -106,7 +106,7 @@ public List load(int first, int pageSize, String sortField, SortOrder so entities = searchService.loadData(first, pageSize, sortField, sortOrder, filterMap); logger.info("{} entities loaded!", entities.size()); return entities; - } catch (DAOException | DataException | ElasticsearchStatusException | QueryShardException + } catch (DAOException | DataException | OpenSearchStatusException | QueryShardException | SQLGrammarException e) { setRowCount(0); logger.error(e.getMessage(), e); diff --git a/Kitodo/src/main/java/org/kitodo/production/model/LazyProcessDTOModel.java b/Kitodo/src/main/java/org/kitodo/production/model/LazyProcessDTOModel.java index e7825f420b0..57ef3c14f70 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/LazyProcessDTOModel.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/LazyProcessDTOModel.java @@ -19,12 +19,12 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.index.query.QueryShardException; import org.kitodo.data.exceptions.DataException; import org.kitodo.exceptions.FilterException; import org.kitodo.production.services.data.FilterService; import org.kitodo.production.services.data.ProcessService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.index.query.QueryShardException; import org.primefaces.PrimeFaces; import org.primefaces.model.FilterMeta; import org.primefaces.model.SortOrder; @@ -120,7 +120,7 @@ public List load(int first, int pageSize, String sortField, SortOrder so this.showClosedProcesses, this.showInactiveProjects); logger.trace("{} entities loaded!", entities.size()); return entities; - } catch (DataException | ElasticsearchStatusException | QueryShardException e) { + } catch (DataException | OpenSearchStatusException | QueryShardException e) { setRowCount(0); logger.error(e.getMessage(), e); } catch (FilterException e) { diff --git a/Kitodo/src/main/java/org/kitodo/production/model/LazyTaskDTOModel.java b/Kitodo/src/main/java/org/kitodo/production/model/LazyTaskDTOModel.java index df24a0ebbe8..0022e3ed116 100644 --- a/Kitodo/src/main/java/org/kitodo/production/model/LazyTaskDTOModel.java +++ b/Kitodo/src/main/java/org/kitodo/production/model/LazyTaskDTOModel.java @@ -19,13 +19,13 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.index.query.QueryShardException; import org.kitodo.data.database.enums.TaskStatus; import org.kitodo.data.exceptions.DataException; import org.kitodo.exceptions.FilterException; import org.kitodo.production.services.data.FilterService; import org.kitodo.production.services.data.TaskService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.index.query.QueryShardException; import org.primefaces.PrimeFaces; import org.primefaces.model.FilterMeta; import org.primefaces.model.SortOrder; @@ -88,7 +88,7 @@ public List load(int first, int pageSize, String sortField, SortOrder so this.taskStatusRestriction); logger.trace("{} entities loaded!", entities.size()); return entities; - } catch (DataException | ElasticsearchStatusException | QueryShardException e) { + } catch (DataException | OpenSearchStatusException | QueryShardException e) { setRowCount(0); logger.error(e.getMessage(), e); } catch (FilterException e) { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java index 84a422084d1..9fb84156a72 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java @@ -17,9 +17,6 @@ import java.util.Map; import java.util.Objects; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; import org.kitodo.data.database.beans.Batch; import org.kitodo.data.database.beans.Process; import org.kitodo.data.database.enums.IndexAction; @@ -35,6 +32,9 @@ import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.TitleSearchService; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; import org.primefaces.model.SortOrder; public class BatchService extends TitleSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java index 9ffaf758a9f..6cebbf689cc 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java @@ -16,9 +16,6 @@ import java.util.Map; import java.util.Objects; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.kitodo.data.database.beans.Docket; import org.kitodo.data.database.exceptions.DAOException; import org.kitodo.data.database.persistence.DocketDAO; @@ -31,6 +28,9 @@ import org.kitodo.production.dto.DocketDTO; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.ClientSearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; import org.primefaces.model.SortOrder; public class DocketService extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java index 64a65d1c317..5de666a0eb1 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java @@ -30,10 +30,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; import org.kitodo.data.database.beans.Filter; @@ -59,6 +55,10 @@ import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.SearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; import org.primefaces.model.SortOrder; /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java index 41df944dec9..0b14433dc26 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java @@ -11,12 +11,12 @@ package org.kitodo.production.services.data; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; -import static org.elasticsearch.index.query.QueryBuilders.multiMatchQuery; -import static org.elasticsearch.index.query.QueryBuilders.nestedQuery; import static org.kitodo.data.database.enums.CorrectionComments.NO_CORRECTION_COMMENTS; import static org.kitodo.data.database.enums.CorrectionComments.NO_OPEN_CORRECTION_COMMENTS; import static org.kitodo.data.database.enums.CorrectionComments.OPEN_CORRECTION_COMMENTS; +import static org.opensearch.index.query.QueryBuilders.matchQuery; +import static org.opensearch.index.query.QueryBuilders.multiMatchQuery; +import static org.opensearch.index.query.QueryBuilders.nestedQuery; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; @@ -84,16 +84,6 @@ import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.Row; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.MatchQueryBuilder; -import org.elasticsearch.index.query.MultiMatchQueryBuilder; -import org.elasticsearch.index.query.NestedQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.WildcardQueryBuilder; -import org.elasticsearch.search.sort.SortBuilder; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortOrder; import org.json.JSONArray; import org.json.JSONObject; import org.json.XML; @@ -162,6 +152,16 @@ import org.kitodo.production.services.workflow.WorkflowControllerService; import org.kitodo.production.workflow.KitodoNamespaceContext; import org.kitodo.serviceloader.KitodoServiceLoader; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.MatchQueryBuilder; +import org.opensearch.index.query.MultiMatchQueryBuilder; +import org.opensearch.index.query.NestedQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.WildcardQueryBuilder; +import org.opensearch.search.sort.SortBuilder; +import org.opensearch.search.sort.SortBuilders; +import org.opensearch.search.sort.SortOrder; import org.primefaces.model.charts.ChartData; import org.primefaces.model.charts.axes.cartesian.linear.CartesianLinearAxes; import org.primefaces.model.charts.bar.BarChartOptions; diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java index 207c3210bb8..eeb05235805 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java @@ -22,10 +22,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.IdsQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; import org.kitodo.config.enums.KitodoConfigFile; import org.kitodo.data.database.beans.Client; import org.kitodo.data.database.beans.Folder; @@ -50,6 +46,10 @@ import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.ClientSearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.IdsQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; import org.primefaces.model.SortOrder; public class ProjectService extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java index 6b015a653b6..ea7ff84285e 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java @@ -23,9 +23,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.kitodo.api.dataeditor.rulesetmanagement.FunctionalDivision; import org.kitodo.api.dataeditor.rulesetmanagement.RulesetManagementInterface; import org.kitodo.config.ConfigCore; @@ -46,6 +43,9 @@ import org.kitodo.production.helper.metadata.legacytypeimplementations.LegacyPrefsHelper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.ClientSearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; import org.primefaces.model.SortOrder; public class RulesetService extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java index e8a30a2c1e5..14891ef3db0 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java @@ -28,9 +28,6 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; import org.kitodo.api.command.CommandResult; import org.kitodo.data.database.beans.Folder; import org.kitodo.data.database.beans.Process; @@ -73,6 +70,9 @@ import org.kitodo.production.services.file.SubfolderFactoryService; import org.kitodo.production.services.image.ImageGenerator; import org.kitodo.production.services.workflow.WorkflowControllerService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; import org.primefaces.model.SortOrder; /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java index cdb2be13383..0df3e44f003 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java @@ -27,8 +27,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; import org.kitodo.config.ConfigCore; import org.kitodo.data.database.beans.Project; import org.kitodo.data.database.beans.Task; @@ -51,6 +49,8 @@ import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.ClientSearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; import org.primefaces.model.SortOrder; public class TemplateService extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java index 0001a519901..9be28308c35 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java @@ -16,8 +16,6 @@ import java.util.Map; import java.util.Objects; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; import org.kitodo.data.database.beans.Workflow; import org.kitodo.data.database.enums.WorkflowStatus; import org.kitodo.data.database.exceptions.DAOException; @@ -31,6 +29,8 @@ import org.kitodo.production.helper.Helper; import org.kitodo.production.services.ServiceManager; import org.kitodo.production.services.data.base.ClientSearchService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; import org.primefaces.model.SortOrder; public class WorkflowService extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ClientSearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ClientSearchService.java index 9aade7f90bd..6e0dd24f7d5 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ClientSearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ClientSearchService.java @@ -11,17 +11,13 @@ package org.kitodo.production.services.data.base; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.sort.SortBuilder; import org.kitodo.data.database.beans.BaseBean; import org.kitodo.data.database.beans.BaseIndexedBean; import org.kitodo.data.database.persistence.BaseDAO; @@ -32,6 +28,10 @@ import org.kitodo.data.exceptions.DataException; import org.kitodo.production.dto.BaseDTO; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.sort.SortBuilder; public abstract class ClientSearchService> extends TitleSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java index 9e9b1245c42..87d2488f514 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java @@ -14,9 +14,6 @@ import java.util.List; import java.util.Objects; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.sort.SortBuilder; import org.kitodo.data.database.beans.BaseIndexedBean; import org.kitodo.data.database.beans.Project; import org.kitodo.data.database.beans.User; @@ -27,6 +24,9 @@ import org.kitodo.data.exceptions.DataException; import org.kitodo.production.dto.BaseDTO; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.sort.SortBuilder; public abstract class ProjectSearchService> extends ClientSearchService { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java index 23a9a09bf00..2238a428a42 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java @@ -11,11 +11,11 @@ package org.kitodo.production.services.data.base; -import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; -import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery; -import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; -import static org.elasticsearch.index.query.QueryBuilders.termsQuery; +import static org.opensearch.index.query.QueryBuilders.matchAllQuery; +import static org.opensearch.index.query.QueryBuilders.matchQuery; +import static org.opensearch.index.query.QueryBuilders.queryStringQuery; +import static org.opensearch.index.query.QueryBuilders.rangeQuery; +import static org.opensearch.index.query.QueryBuilders.termsQuery; import java.io.IOException; import java.util.ArrayList; @@ -32,17 +32,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.aggregations.BucketOrder; -import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.sort.SortBuilder; -import org.elasticsearch.search.sort.SortBuilders; import org.kitodo.data.database.beans.BaseBean; import org.kitodo.data.database.beans.BaseIndexedBean; import org.kitodo.data.database.enums.IndexAction; @@ -57,6 +46,17 @@ import org.kitodo.production.dto.BaseDTO; import org.kitodo.production.helper.Helper; import org.kitodo.production.services.data.ProjectService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.Aggregations; +import org.opensearch.search.aggregations.BucketOrder; +import org.opensearch.search.aggregations.bucket.terms.ParsedStringTerms; +import org.opensearch.search.aggregations.bucket.terms.Terms; +import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; +import org.opensearch.search.sort.SortBuilder; +import org.opensearch.search.sort.SortBuilders; import org.primefaces.model.SortOrder; /** @@ -935,9 +935,9 @@ private List getRelatedPropertyForDTO(Map object, Strin protected SortBuilder getSortBuilder(String sortField, SortOrder sortOrder) { if (!Objects.equals(sortField, null) && Objects.equals(sortOrder, SortOrder.ASCENDING)) { - return SortBuilders.fieldSort(sortField).order(org.elasticsearch.search.sort.SortOrder.ASC); + return SortBuilders.fieldSort(sortField).order(org.opensearch.search.sort.SortOrder.ASC); } else if (!Objects.equals(sortField, null) && Objects.equals(sortOrder, SortOrder.DESCENDING)) { - return SortBuilders.fieldSort(sortField).order(org.elasticsearch.search.sort.SortOrder.DESC); + return SortBuilders.fieldSort(sortField).order(org.opensearch.search.sort.SortOrder.DESC); } else { return null; } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java index 3ba5322730d..dcaab5164c4 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/TitleSearchService.java @@ -14,11 +14,6 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.sort.SortBuilder; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortOrder; import org.kitodo.data.database.beans.BaseIndexedBean; import org.kitodo.data.database.persistence.BaseDAO; import org.kitodo.data.elasticsearch.index.Indexer; @@ -26,6 +21,11 @@ import org.kitodo.data.elasticsearch.search.Searcher; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.dto.BaseDTO; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.sort.SortBuilder; +import org.opensearch.search.sort.SortBuilders; +import org.opensearch.search.sort.SortOrder; /** * Class for implementing methods used by service classes which search for title diff --git a/Kitodo/src/test/java/org/kitodo/MockDatabase.java b/Kitodo/src/test/java/org/kitodo/MockDatabase.java index 641d156762c..014b36bb0b3 100644 --- a/Kitodo/src/test/java/org/kitodo/MockDatabase.java +++ b/Kitodo/src/test/java/org/kitodo/MockDatabase.java @@ -49,11 +49,6 @@ import org.apache.logging.log4j.Logger; import org.awaitility.Awaitility; import org.awaitility.Durations; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.node.InternalSettingsPreparer; -import org.elasticsearch.node.Node; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.transport.Netty4Plugin; import org.h2.tools.Server; import org.hibernate.Session; import org.hibernate.Transaction; @@ -106,6 +101,11 @@ import org.kitodo.production.workflow.model.Converter; import org.kitodo.test.utils.ProcessTestUtils; import org.kitodo.test.utils.TestConstants; +import org.opensearch.common.settings.Settings; +import org.opensearch.node.InternalSettingsPreparer; +import org.opensearch.node.Node; +import org.opensearch.plugins.Plugin; +import org.opensearch.transport.Netty4Plugin; import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp; import static com.xebialabs.restito.semantics.Condition.get; diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/BatchServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/BatchServiceIT.java index 25f263f89ee..51c07db629b 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/BatchServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/BatchServiceIT.java @@ -12,16 +12,14 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.given; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.List; import java.util.Objects; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -31,6 +29,8 @@ import org.kitodo.data.database.exceptions.DAOException; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; /** * Tests for BatchService class. diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/DocketServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/DocketServiceIT.java index 49a9ed9ae29..29b22b01989 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/DocketServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/DocketServiceIT.java @@ -12,16 +12,14 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.given; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.List; import java.util.Objects; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -33,6 +31,8 @@ import org.kitodo.data.elasticsearch.index.type.enums.DocketTypeField; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; /** * Tests for DocketService class. diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/FilterServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/FilterServiceIT.java index 8b2feb934bc..ee55fe6cbdc 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/FilterServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/FilterServiceIT.java @@ -12,19 +12,14 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.given; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.List; import java.util.Objects; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortOrder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; @@ -36,6 +31,11 @@ import org.kitodo.production.dto.TaskDTO; import org.kitodo.production.enums.ObjectType; import org.kitodo.production.services.ServiceManager; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.sort.SortBuilders; +import org.opensearch.search.sort.SortOrder; /** * Integration tests for FilterService. @@ -481,7 +481,7 @@ public void shouldBuildQueryForEmptyConditions() throws Exception { // empty condition is not allowed and throws Exception in ElasticSearch 7 query = filterService.queryBuilder("\"id:\"", ObjectType.PROCESS, false, false); QueryBuilder finalQuery = query; - assertThrows(ElasticsearchStatusException.class, + assertThrows(OpenSearchStatusException.class, () -> processService.findByQuery(finalQuery, true)); } } diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java index c220f2579aa..766f23bcb5c 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java @@ -12,13 +12,13 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.await; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.io.File; import java.io.IOException; @@ -33,8 +33,6 @@ import java.util.OptionalInt; import org.apache.commons.lang3.SystemUtils; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; @@ -65,6 +63,8 @@ import org.kitodo.production.services.dataformat.MetsService; import org.kitodo.production.services.file.FileService; import org.kitodo.test.utils.ProcessTestUtils; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; /** * Tests for ProcessService class. diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/ProjectServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/ProjectServiceIT.java index 4683d3c6ea9..014a4149bde 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/ProjectServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/ProjectServiceIT.java @@ -12,16 +12,14 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.await; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.List; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -33,6 +31,8 @@ import org.kitodo.data.exceptions.DataException; import org.kitodo.production.dto.ProjectDTO; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; /** * Tests for ProjectService class. diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/RulesetServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/RulesetServiceIT.java index 4f38ac512b9..b0bf2f9f248 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/RulesetServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/RulesetServiceIT.java @@ -12,15 +12,13 @@ package org.kitodo.production.services.data; import static org.awaitility.Awaitility.await; -import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.opensearch.index.query.QueryBuilders.matchQuery; import java.util.List; -import org.elasticsearch.index.query.Operator; -import org.elasticsearch.index.query.QueryBuilder; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -32,6 +30,8 @@ import org.kitodo.data.elasticsearch.index.type.enums.RulesetTypeField; import org.kitodo.data.exceptions.DataException; import org.kitodo.production.services.ServiceManager; +import org.opensearch.index.query.Operator; +import org.opensearch.index.query.QueryBuilder; /** * Tests for RulesetService class. diff --git a/pom.xml b/pom.xml index 20801c6f0bf..14ed916cf17 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 9.9.1-8 2.19.0 5.9.2 - 7.17.24 + [2.15.0,) 2.22.2 - org.elasticsearch.client - elasticsearch-rest-high-level-client - ${elasticsearch.version} - - - commons-codec - commons-codec - - - commons-logging - commons-logging - - + org.opensearch + opensearch + ${opensearch.version} + + + org.opensearch + opensearch-core + ${opensearch.version} + + + org.opensearch.client + opensearch-rest-client + ${opensearch.version} - org.elasticsearch.client - transport - ${elasticsearch.version} + org.opensearch.client + opensearch-rest-high-level-client + ${opensearch.version} - org.elasticsearch.plugin + org.opensearch.plugin transport-netty4-client - ${elasticsearch.version} + ${opensearch.version} test