Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<jersey.version>2.28</jersey.version>
<graalvm.version>22.3.3</graalvm.version>
<micrometer.version>1.13.10</micrometer.version>
<opensearch.version>3.3.0</opensearch.version>
</properties>
<dependencyManagement>

Expand Down Expand Up @@ -839,6 +840,41 @@
<version>4.4.6</version>
</dependency>

<!-- OpenSearch 3.x Modern Client -->
<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<version>${opensearch.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.5</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.3.4</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5-h2</artifactId>
<version>5.3.4</version>
</dependency>

<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand Down
30 changes: 30 additions & 0 deletions dotCMS/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,36 @@
<artifactId>jedis</artifactId>
</dependency>

<dependency>
<groupId>org.opensearch.client</groupId>
<artifactId>opensearch-java</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5-h2</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
</dependency>

<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

package com.dotcms.enterprise.priv;

import static com.dotcms.content.elasticsearch.business.ESIndexAPI.INDEX_OPERATIONS_TIMEOUT_IN_MS;

import com.dotcms.content.elasticsearch.business.ESContentFactoryImpl;
import com.dotcms.content.elasticsearch.business.ESSearchResults;
import com.dotcms.content.elasticsearch.business.IndiciesInfo;
import com.dotcms.content.elasticsearch.business.IndicesInfo;
import com.dotcms.content.elasticsearch.util.RestHighLevelClientProvider;
import com.dotcms.enterprise.ESSeachAPI;
import com.dotcms.enterprise.priv.util.SearchSourceBuilderUtil;
Expand All @@ -29,6 +31,10 @@
import com.dotmarketing.util.json.JSONException;
import com.dotmarketing.util.json.JSONObject;
import com.liferay.portal.model.User;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
Expand All @@ -37,13 +43,6 @@
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static com.dotcms.content.elasticsearch.business.ESIndexAPI.INDEX_OPERATIONS_TIMEOUT_IN_MS;

/**
* Implementation class for the {@link ESSeachAPI}.
*
Expand Down Expand Up @@ -200,9 +199,9 @@ private SearchResponse esSearchRaw(JSONObject jsonObject, boolean live, User use
throws DotSecurityException, DotDataException {

String indexToHit;
IndiciesInfo info;
IndicesInfo info;
try {
info = APILocator.getIndiciesAPI().loadIndicies();
info = APILocator.getIndiciesAPI().loadLegacyIndices();
if (live) {
indexToHit = info.getLive();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ public class ESSiteSearchAPI implements SiteSearchAPI{

private final ESIndexAPI indexApi;
private final ESMappingAPIImpl mappingAPI;
private final IndiciesAPI indiciesAPI;
private final IndicesAPI indicesAPI;
private ArrayList<Object> list;
private int indexPosition;

@VisibleForTesting
public ESSiteSearchAPI(final ESIndexAPI indexApi,
final ESMappingAPIImpl mappingAPI,
final IndiciesAPI indiciesAPI) {
final IndicesAPI indicesAPI) {
this.indexApi = indexApi;
this.mappingAPI = mappingAPI;
this.indiciesAPI = indiciesAPI;
this.indicesAPI = indicesAPI;
}

public ESSiteSearchAPI() {
Expand Down Expand Up @@ -122,7 +122,7 @@ private void setDefaultToSpecificPosition(final List<String> list, final int ind

try {
//search the default site search index
final String defaultIndice = indiciesAPI.loadIndicies().getSiteSearch();
final String defaultIndice = indicesAPI.loadLegacyIndices().getSiteSearch();
if (defaultIndice != null && !defaultIndice.isEmpty() && !list.isEmpty() ){
final int index = list.indexOf(defaultIndice);
//change the element defaultIndex to the first position of the arraylist if it is not yet
Expand Down Expand Up @@ -170,7 +170,7 @@ public SiteSearchResults search(String query, int start, int rows) throws Elasti
try{


results = search(indiciesAPI.loadIndicies().getSiteSearch(), query, start, rows);
results = search(indicesAPI.loadLegacyIndices().getSiteSearch(), query, start, rows);


}
Expand Down Expand Up @@ -210,7 +210,7 @@ public SiteSearchResults search(String indexName, String query, int offset, int
SearchResponse resp = null;
try {
if(indexName ==null){
indexName = indiciesAPI.loadIndicies().getSiteSearch();
indexName = indicesAPI.loadLegacyIndices().getSiteSearch();
}
if(!IndexType.SITE_SEARCH.is(indexName)){
throw new ElasticsearchException(indexName + " is not a sitesearch index");
Expand Down Expand Up @@ -317,36 +317,36 @@ public SiteSearchResults search(String indexName, String query, int offset, int
*/
@Override
public boolean isDefaultIndex(final String indexName) throws DotDataException {
return indexName.equals(indiciesAPI.loadIndicies().getSiteSearch());
return indexName.equals(indicesAPI.loadLegacyIndices().getSiteSearch());
}

@Override
public void activateIndex(String indexName) throws DotDataException {
if(LicenseUtil.getLevel() < LicenseLevel.STANDARD.level)
return;

final IndiciesInfo info = indiciesAPI.loadIndicies();
final IndiciesInfo.Builder builder = IndiciesInfo.Builder.copy(info);
final IndicesInfo info = indicesAPI.loadLegacyIndices();
final LegacyIndicesInfo.Builder builder = LegacyIndicesInfo.Builder.copy(info);

if(IndexType.SITE_SEARCH.is(indexName)) {
builder.setSiteSearch(indexName);
}

indiciesAPI.point(builder.build());
indicesAPI.point(builder.build());
}

@Override
public void deactivateIndex(String indexName) throws DotDataException, IOException {
if(LicenseUtil.getLevel() < LicenseLevel.STANDARD.level)
return;

final IndiciesInfo info = indiciesAPI.loadIndicies();
final IndiciesInfo.Builder builder = IndiciesInfo.Builder.copy(info);
final IndicesInfo info = indicesAPI.loadLegacyIndices();
final LegacyIndicesInfo.Builder builder = LegacyIndicesInfo.Builder.copy(info);
if(IndexType.SITE_SEARCH.is(indexName)) {
builder.setSiteSearch(null);
}

indiciesAPI.point(builder.build());
indicesAPI.point(builder.build());
}

@Override
Expand Down Expand Up @@ -625,7 +625,7 @@ public Map<String, Aggregation> getAggregations ( String indexName, String query

RestHighLevelClient client = RestHighLevelClientProvider.getInstance().getClient();
if ( indexName == null ) {
indexName = indiciesAPI.loadIndicies().getSiteSearch();
indexName = indicesAPI.loadLegacyIndices().getSiteSearch();
}
if ( !indexApi.indexExists( indexName ) ) {
// try using it as an alias
Expand Down Expand Up @@ -660,7 +660,7 @@ public Map<String, Aggregation> getFacets ( String indexName, String query ) thr

final RestHighLevelClient client = RestHighLevelClientProvider.getInstance().getClient();
if ( indexName == null ) {
indexName = indiciesAPI.loadIndicies().getSiteSearch();
indexName = indicesAPI.loadLegacyIndices().getSiteSearch();
}
if ( !indexApi.indexExists( indexName ) ) {
// try using it as an alias
Expand Down Expand Up @@ -705,7 +705,7 @@ public void deleteOldSiteSearchIndices(){
indicesToRemove.addAll(listIndices());

//Remove Default SiteSearch Index
final IndiciesInfo info = Try.of(()->APILocator.getIndiciesAPI().loadIndicies())
final IndicesInfo info = Try.of(()->APILocator.getIndiciesAPI().loadLegacyIndices())
.getOrNull();

if(info!=null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public interface ContentletIndexAPI {
*/
public void checkAndInitialiazeIndex();

public boolean createContentIndex(String indexName) throws DotIndexException, IOException;
public boolean createContentIndexLegacy(String indexName) throws DotIndexException, IOException;

public boolean createContentIndex(String indexName, int shards) throws DotIndexException, IOException;
public boolean createContentIndexLegacy(String indexName, int shards) throws DotIndexException, IOException;

/**
* creates new working and live indexes with reading aliases pointing to old index and write aliases
Expand Down Expand Up @@ -130,13 +130,13 @@ public void removeContentFromIndexByContentType(final ContentType contentType)

void addContentToIndex(Contentlet content, boolean deps) throws DotDataException;

BulkRequest createBulkRequest(List<Contentlet> contentToIndex) throws DotDataException;
BulkRequest createBulkRequestLegacy(List<Contentlet> contentToIndex) throws DotDataException;

BulkRequest createBulkRequest();
BulkRequest createBulkRequestLegacy();

BulkRequest appendBulkRequest(BulkRequest bulkRequest, Collection<ReindexEntry> idxs) throws DotDataException;
BulkRequest appendBulkRequestLegacy(BulkRequest bulkRequest, Collection<ReindexEntry> idxs) throws DotDataException;

BulkRequest appendBulkRequest(BulkRequest bulkRequest, ReindexEntry idx) throws DotDataException;
BulkRequest appendBulkRequestLegacy(BulkRequest bulkRequest, ReindexEntry idx) throws DotDataException;

Optional<String> reindexTimeElapsed();

Expand All @@ -148,7 +148,7 @@ public void removeContentFromIndexByContentType(final ContentType contentType)

BulkRequest appendBulkRemoveRequest(BulkRequest bulkRequest, final ReindexEntry entry) throws DotDataException;

BulkProcessor createBulkProcessor(BulkProcessorListener bulkListener);
BulkProcessor createBulkProcessorLegacy(BulkProcessorListener bulkListener);

void appendToBulkProcessor(final BulkProcessor bulk, final Collection<ReindexEntry> idxs) throws DotDataException;
void appendToBulkProcessorLegacy(final BulkProcessor bulk, final Collection<ReindexEntry> idxs) throws DotDataException;
}
Loading
Loading