Skip to content

Commit

Permalink
SAK-46832 Search upgrade elasticsearch to 7.16.3 (sakaiproject#10185)
Browse files Browse the repository at this point in the history
  • Loading branch information
ern authored Jan 24, 2022
1 parent fddd08a commit aa5f488
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 73 deletions.
27 changes: 16 additions & 11 deletions deploy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,6 @@
<artifactId>lucene-join</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial-extras</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial3d</artifactId>
Expand Down Expand Up @@ -291,6 +281,21 @@
<artifactId>elasticsearch-x-content</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-geo</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-lz4</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand All @@ -312,7 +317,7 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,18 +557,16 @@ private void indexRecursive(IndexWriter indexWriter, Set<Category> categories)
if (doc != null)
{
indexWriter.addDocument(doc);
log.debug("added resource '" + resource.getName() + "', doc count="
+ indexWriter.maxDoc());
log.debug("added resource '{}', doc count={}", resource.getName(), indexWriter.getDocStats().maxDoc);
}
else
{
log.debug("failed to add resource '" + "' (" + resource.getName());
log.debug("failed to add resource '{}'", resource.getName());
}
}
catch (IOException e)
{
log.error("I/O error while adding resource '" + "' ("
+ resource.getName() + "): " + e.getMessage(), e);
log.error("I/O error while adding resource '{}' ({})", resource.getName(), e.toString());
}
}

Expand Down
50 changes: 32 additions & 18 deletions master/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<sakai.ehcache.groupId>net.sf.ehcache</sakai.ehcache.groupId>
<sakai.ehcache.artifactId>ehcache-core</sakai.ehcache.artifactId>
<sakai.ehcache.version>2.6.11</sakai.ehcache.version>
<sakai.elasticsearch.version>6.8.21</sakai.elasticsearch.version>
<sakai.elasticsearch.version>7.16.3</sakai.elasticsearch.version>
<sakai.hibernate.version>5.3.20.Final</sakai.hibernate.version>
<sakai.hikaricp.version>4.0.3</sakai.hikaricp.version>
<sakai.httpclient.version>4.5.13</sakai.httpclient.version>
Expand All @@ -52,7 +52,7 @@
<sakai.java.jwt.version>3.1.0</sakai.java.jwt.version>
<sakai.jstl.version>1.2</sakai.jstl.version>
<sakai.lombok.version>1.18.22</sakai.lombok.version>
<sakai.lucene.version>7.7.3</sakai.lucene.version>
<sakai.lucene.version>8.10.1</sakai.lucene.version>
<sakai.netty.version>4.1.68.Final</sakai.netty.version>
<sakai.org.json.version>20210307</sakai.org.json.version>
<sakai.pluto.version>1.1.7</sakai.pluto.version>
Expand Down Expand Up @@ -320,6 +320,14 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>codelibs.org</id>
<name>CodeLibs Repository</name>
<url>https://maven.codelibs.org/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<dependencyManagement>
Expand Down Expand Up @@ -1274,6 +1282,24 @@
<version>${sakai.elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-geo</artifactId>
<version>${sakai.elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-lz4</artifactId>
<version>${sakai.elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
<version>1.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand All @@ -1295,7 +1321,7 @@
<dependency>
<groupId>org.codelibs.elasticsearch.module</groupId>
<artifactId>analysis-common</artifactId>
<version>6.8.12</version>
<version>${sakai.elasticsearch.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -1450,28 +1476,16 @@
<version>${sakai.lucene.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial</artifactId>
<version>${sakai.lucene.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial-extras</artifactId>
<version>${sakai.lucene.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial3d</artifactId>
<version>${sakai.lucene.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.5.0</version>
<version>5.10.0</version>
<scope>provided</scope>
</dependency>
<!-- elasticsearch 3rd party libs -->
Expand All @@ -1496,7 +1510,7 @@
<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>hppc</artifactId>
<version>0.7.2</version>
<version>0.8.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.tophits.TopHits;
import org.elasticsearch.search.aggregations.metrics.TopHits;
import org.sakaiproject.component.api.ServerConfigurationService;
import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.search.api.SearchService;
Expand Down Expand Up @@ -350,7 +350,7 @@ public boolean userOwns(String questionId){
try {

SearchResponse sr = searchService.searchResponse("", null, 0, 1, "questions", additionalSearchInformation);
if (sr.getHits().totalHits < 1) {
if (sr.getHits().getTotalHits().value < 1) {
questionsIOwn.put(questionId, Boolean.FALSE);
return false;
} else {
Expand Down
7 changes: 5 additions & 2 deletions samigo/samigo-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.sakaiproject.search.elasticsearch</groupId>
<artifactId>elasticsearch-util</artifactId>
<version>${project.version}</version>
<version>${sakai.version}</version>
</dependency>
<dependency>
<groupId>org.sakaiproject.search.elasticsearch</groupId>
Expand All @@ -57,7 +57,10 @@
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${sakai.elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-x-content</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,15 @@
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.Operator;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.xcontent.XContentBuilder;
import org.osid.shared.SharedException;
import org.sakaiproject.event.api.Event;
import org.sakaiproject.event.api.NotificationService;
Expand Down
58 changes: 46 additions & 12 deletions search/elasticsearch/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,38 @@
</properties>

<dependencies>
<!-- Dependencies -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-core</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-cli</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-secure-sm</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-x-content</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-geo</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch-lz4</artifactId>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand All @@ -40,8 +67,20 @@
<artifactId>analysis-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>parent-join-client</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>aggs-matrix-stats-client</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>rank-eval-client</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>lang-mustache-client</artifactId>
</dependency>
<!-- Lucene -->
<dependency>
Expand Down Expand Up @@ -88,14 +127,6 @@
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-sandbox</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial-extras</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial3d</artifactId>
Expand Down Expand Up @@ -138,7 +169,6 @@
<dependency>
<groupId>org.sakaiproject.kernel</groupId>
<artifactId>sakai-component-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -160,6 +190,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public ElasticSearchList(String searchTerms, SearchResponse response, ElasticSea
List<String> references = new ArrayList<>();

SearchHits hits = response.getHits();
if (hits.getTotalHits() > 0) {
if (hits.getTotalHits().value > 0) {
for (SearchHit hit : hits) {
references.add(searchIndexBuilder.getFieldFromSearchHit(SearchService.FIELD_REFERENCE, hit));
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public int getFullSize() {
if (response == null) {
return 0;
}
return (int) response.getHits().getTotalHits();
return (int) response.getHits().getTotalHits().value;
}

@Override
Expand Down
Loading

0 comments on commit aa5f488

Please sign in to comment.