Skip to content

Commit 8f1e881

Browse files
porunovli-boxuan
authored andcommitted
Add ElasticSearch 9 support
Signed-off-by: Oleksandr Porunov <[email protected]>
1 parent e5b44c7 commit 8f1e881

File tree

11 files changed

+74
-13
lines changed

11 files changed

+74
-13
lines changed

.github/workflows/ci-index-es-dummy.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ jobs:
3131
strategy:
3232
matrix:
3333
include:
34+
- module: es
35+
args: "-Pelasticsearch9"
36+
name: es9-java8
37+
java: 8
3438
- module: es
3539
args: "-Pelasticsearch8"
3640
name: es8
@@ -47,6 +51,11 @@ jobs:
4751
args: "-Pelasticsearch60"
4852
name: es60
4953
java: 8
54+
- module: es
55+
install-args: "-Pjava-11"
56+
args: "-Pelasticsearch9"
57+
name: es9
58+
java: 11
5059
- module: es
5160
install-args: "-Pjava-11"
5261
args: "-Pelasticsearch8"

.github/workflows/ci-index-es.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ jobs:
6666
fail-fast: false
6767
matrix:
6868
include:
69+
- module: es
70+
args: "-Pelasticsearch9"
71+
name: es9-java8
72+
java: 8
6973
- module: es
7074
args: "-Pelasticsearch8"
7175
name: es8-java8
@@ -82,6 +86,11 @@ jobs:
8286
args: "-Pelasticsearch60"
8387
name: es60-java8
8488
java: 8
89+
- module: es
90+
install-args: "-Pjava-11"
91+
args: "-Pelasticsearch9"
92+
name: es9
93+
java: 11
8594
- module: es
8695
install-args: "-Pjava-11"
8796
args: "-Pelasticsearch8"

docs/changelog.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ All currently supported versions of JanusGraph are listed below.
2727

2828
| JanusGraph | Storage Version | Cassandra | HBase | Bigtable | ScyllaDB | Elasticsearch | Solr | TinkerPop | Spark | Scala |
2929
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
30-
| 1.2.z | 2 | 3.11.z, 4.0.z | 2.6.z | 1.3.0, 1.4.0, 1.5.z, 1.6.z, 1.7.z, 1.8.z, 1.9.z, 1.10.z, 1.11.z, 1.14.z | 6.y | 6.y, 7.y, 8.y | 8.y | 3.7.z | 3.2.z | 2.12.z |
30+
| 1.2.z | 2 | 3.11.z, 4.0.z | 2.6.z | 1.3.0, 1.4.0, 1.5.z, 1.6.z, 1.7.z, 1.8.z, 1.9.z, 1.10.z, 1.11.z, 1.14.z | 6.y | 6.y, 7.y, 8.y, 9.y | 8.y | 3.7.z | 3.2.z | 2.12.z |
3131
| 1.1.z | 2 | 3.11.z, 4.0.z | 2.6.z | 1.3.0, 1.4.0, 1.5.z, 1.6.z, 1.7.z, 1.8.z, 1.9.z, 1.10.z, 1.11.z, 1.14.z | 6.y | 6.y, 7.y, 8.y | 8.y | 3.7.z | 3.2.z | 2.12.z |
3232

3333
!!! info
@@ -75,7 +75,7 @@ compile "org.janusgraph:janusgraph-core:1.2.0"
7575
* Apache HBase 2.6.0
7676
* Oracle BerkeleyJE 7.5.11
7777
* ScyllaDB 6.2.0
78-
* Elasticsearch 6.0.1, 6.6.0, 7.17.8, 8.15.3
78+
* Elasticsearch 6.0.1, 6.6.0, 7.17.8, 8.15.3, 9.0.3
7979
* Apache Lucene 8.11.1
8080
* Apache Solr 8.11.1
8181
* Apache TinkerPop 3.7.3
@@ -99,6 +99,12 @@ For more information on features and bug fixes in 1.2.0, see the GitHub mileston
9999
* [JanusGraph zip](https://github.com/JanusGraph/janusgraph/releases/download/v1.2.0/janusgraph-1.2.0.zip)
100100
* [JanusGraph zip with embedded Cassandra and ElasticSearch](https://github.com/JanusGraph/janusgraph/releases/download/v1.2.0/janusgraph-full-1.2.0.zip)
101101

102+
#### Upgrade Instructions
103+
104+
##### ElasticSearch 9 support
105+
106+
Starting from version 1.2.0 JanusGraph supports ElasticSearch 9.
107+
102108
### Version 1.1.0 (Release Date: November 7, 2024)
103109

104110
/// tab | Maven

janusgraph-es/pom.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
<elasticsearch60.docker.version>6.0.1</elasticsearch60.docker.version>
1515
<elasticsearch6.docker.version>6.6.0</elasticsearch6.docker.version>
1616
<elasticsearch7.docker.version>7.17.8</elasticsearch7.docker.version>
17-
<elasticsearch8.docker.version>${elasticsearch.version}</elasticsearch8.docker.version>
18-
<elasticsearch.docker.version>${elasticsearch8.docker.version}</elasticsearch.docker.version>
17+
<elasticsearch8.docker.version>8.15.3</elasticsearch8.docker.version>
18+
<elasticsearch9.docker.version>${elasticsearch.version}</elasticsearch9.docker.version>
19+
<elasticsearch.docker.version>${elasticsearch9.docker.version}</elasticsearch.docker.version>
1920
<skip.es.test>${skipTests}</skip.es.test>
2021
<elasticsearch.docker.image>docker.elastic.co/elasticsearch/elasticsearch</elasticsearch.docker.image>
2122
</properties>
@@ -198,11 +199,17 @@
198199
</profile>
199200
<profile>
200201
<id>elasticsearch8</id>
202+
<properties>
203+
<elasticsearch.docker.version>${elasticsearch8.docker.version}</elasticsearch.docker.version>
204+
</properties>
205+
</profile>
206+
<profile>
207+
<id>elasticsearch9</id>
201208
<activation>
202209
<activeByDefault>true</activeByDefault>
203210
</activation>
204211
<properties>
205-
<elasticsearch.docker.version>${elasticsearch8.docker.version}</elasticsearch.docker.version>
212+
<elasticsearch.docker.version>${elasticsearch9.docker.version}</elasticsearch.docker.version>
206213
</properties>
207214
</profile>
208215

janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/ElasticMajorVersion.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public enum ElasticMajorVersion {
2525

2626
EIGHT(8),
2727

28+
NINE(9),
2829
;
2930

3031
static final Pattern PATTERN = Pattern.compile("(\\d+)\\.\\d+\\.\\d+.*");
@@ -48,6 +49,8 @@ public static ElasticMajorVersion parse(final String value) {
4849
return ElasticMajorVersion.SEVEN;
4950
case 8:
5051
return ElasticMajorVersion.EIGHT;
52+
case 9:
53+
return ElasticMajorVersion.NINE;
5154
default:
5255
throw new IllegalArgumentException("Unsupported Elasticsearch server major version: " + value);
5356
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2023 JanusGraph Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package org.janusgraph.diskstorage.es.compat;
16+
17+
import org.janusgraph.diskstorage.indexing.IndexFeatures;
18+
19+
import static org.janusgraph.diskstorage.es.ElasticSearchConstants.CUSTOM_ALL_FIELD;
20+
21+
public class ES9Compat extends AbstractESCompat {
22+
23+
private static final IndexFeatures FEATURES = coreFeatures().setWildcardField(CUSTOM_ALL_FIELD).supportsGeoContains().build();
24+
25+
@Override
26+
public IndexFeatures getIndexFeatures() {
27+
return FEATURES;
28+
}
29+
}

janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/compat/ESCompatUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public static AbstractESCompat acquireCompatForVersion(ElasticMajorVersion elast
2828
return new ES7Compat();
2929
case EIGHT:
3030
return new ES8Compat();
31+
case NINE:
32+
return new ES9Compat();
3133
default:
3234
throw new PermanentBackendException("Unsupported Elasticsearch version: " + elasticMajorVersion);
3335
}

janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/rest/RestElasticSearchClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public class RestElasticSearchClient implements ElasticSearchClient {
102102
mapWriter = mapper.writerWithView(Map.class);
103103
}
104104

105-
private static final ElasticMajorVersion DEFAULT_VERSION = ElasticMajorVersion.EIGHT;
105+
private static final ElasticMajorVersion DEFAULT_VERSION = ElasticMajorVersion.NINE;
106106

107107
private static final Function<StringBuilder, StringBuilder> APPEND_OP = sb -> sb.append(sb.length() == 0 ? REQUEST_PARAM_BEGINNING : REQUEST_PARAM_SEPARATOR);
108108

janusgraph-es/src/test/java/org/janusgraph/diskstorage/es/ElasticsearchIndexTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
import static org.junit.jupiter.api.Assertions.assertFalse;
8686
import static org.junit.jupiter.api.Assertions.assertThrows;
8787
import static org.junit.jupiter.api.Assertions.assertTrue;
88-
import static org.junit.jupiter.api.Assertions.fail;
8988

9089
/**
9190
* @author Matthias Broecheler ([email protected])
@@ -229,9 +228,6 @@ public void testErrorInBatch() throws Exception {
229228
String message = Throwables.getRootCause(janusGraphException).getMessage();
230229

231230
switch (JanusGraphElasticsearchContainer.getEsMajorVersion().value){
232-
case 8:
233-
assertTrue(message.contains("document_parsing_exception"));
234-
break;
235231
case 7:
236232
case 6:
237233
assertTrue(message.contains("mapper_parsing_exception"));
@@ -240,7 +236,7 @@ public void testErrorInBatch() throws Exception {
240236
assertTrue(message.contains("number_format_exception"));
241237
break;
242238
default:
243-
fail();
239+
assertTrue(message.contains("document_parsing_exception"));
244240
break;
245241
}
246242

janusgraph-es/src/test/java/org/janusgraph/diskstorage/es/JanusGraphElasticsearchContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
public class JanusGraphElasticsearchContainer extends ElasticsearchContainer {
3838

3939
private static final Integer ELASTIC_PORT = 9200;
40-
private static final String DEFAULT_VERSION = "8.15.3";
40+
private static final String DEFAULT_VERSION = "9.0.3";
4141
private static final String DEFAULT_IMAGE = "docker.elastic.co/elasticsearch/elasticsearch";
4242

4343
public static ElasticMajorVersion getEsMajorVersion() {

0 commit comments

Comments
 (0)