Skip to content

Commit 465da6a

Browse files
committed
es 8.16.0 support
1 parent 95e8b0a commit 465da6a

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jdk:
55

66
before_install:
77
- sudo rm -rf /var/lib/elasticsearch
8-
- curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.15.5-amd64.deb -o elasticsearch.deb && sudo dpkg -i --force-confnew elasticsearch.deb
8+
- curl https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.16.0-amd64.deb -o elasticsearch.deb && sudo dpkg -i --force-confnew elasticsearch.deb
99
- sudo cp ./src/test/resources/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
1010
- sudo cat /etc/elasticsearch/elasticsearch.yml
1111
- sudo java -version

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nlpcn</groupId>
55
<artifactId>elasticsearch-sql</artifactId>
6-
<version>8.15.5.0</version>
6+
<version>8.16.0.0</version>
77
<packaging>jar</packaging>
88
<description>Query elasticsearch using SQL</description>
99
<name>elasticsearch-sql</name>
@@ -44,7 +44,7 @@
4444
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4545
<runSuite>**/MainTestSuite.class</runSuite>
4646
<elasticsearch.plugin.name>sql</elasticsearch.plugin.name>
47-
<elasticsearch.version>8.15.5</elasticsearch.version>
47+
<elasticsearch.version>8.16.0</elasticsearch.version>
4848
<elasticsearch.plugin.classname>org.elasticsearch.plugin.nlpcn.SqlPlug</elasticsearch.plugin.classname>
4949
<druid.version>1.2.15</druid.version>
5050
<guava.version>32.0.0-jre</guava.version>

src/main/java/org/nlpcn/es4sql/Test.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.elasticsearch.client.internal.node.NodeClient;
55
import org.elasticsearch.common.settings.Settings;
66
import org.elasticsearch.telemetry.metric.MeterRegistry;
7+
import org.elasticsearch.threadpool.DefaultBuiltInExecutorBuilders;
78
import org.elasticsearch.threadpool.ThreadPool;
89

910
import java.util.HashMap;
@@ -22,7 +23,7 @@ public static String sqlToEsQuery(String sql) throws Exception {
2223
// .put(ThreadContext.PREFIX + ".key2", "val 2")
2324
// .build();
2425

25-
ThreadPool threadPool = new ThreadPool(settings, MeterRegistry.NOOP);
26+
ThreadPool threadPool = new ThreadPool(settings, MeterRegistry.NOOP, new DefaultBuiltInExecutorBuilders());
2627
Client client = new NodeClient(settings, threadPool);
2728
SearchDao searchDao = new org.nlpcn.es4sql.SearchDao(client);
2829
try {

src/test/java/org/nlpcn/es4sql/MainTestSuite.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.elasticsearch.client.RestClientBuilder;
2222
import org.elasticsearch.client.internal.Client;
2323
import org.elasticsearch.common.transport.TransportAddress;
24+
import org.elasticsearch.core.TimeValue;
2425
import org.elasticsearch.index.query.QueryBuilders;
2526
import org.elasticsearch.index.reindex.DeleteByQueryRequestBuilder;
2627
import org.elasticsearch.plugin.nlpcn.client.ElasticsearchRestClient;
@@ -82,7 +83,7 @@ public static void setUp() throws Exception {
8283
String clusterName = nodeInfos.getClusterName().value();
8384
System.out.println(String.format("Found cluster... cluster name: %s", clusterName));
8485

85-
client.admin().cluster().prepareUpdateSettings().setTransientSettings(ImmutableMap.of(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false)).get();
86+
client.admin().cluster().prepareUpdateSettings(TimeValue.ONE_MINUTE, TimeValue.ONE_MINUTE).setTransientSettings(ImmutableMap.of(DestructiveOperations.REQUIRES_NAME_SETTING.getKey(), false)).get();
8687

8788
// Load test data.
8889
loadBulk("src/test/resources/online.json", TEST_INDEX_ONLINE);
@@ -147,7 +148,7 @@ private static void createTestIndex(String index) {
147148
}
148149

149150
private static void deleteTestIndex(String index) {
150-
if(client.admin().cluster().prepareState().execute().actionGet().getState().getMetadata().hasIndex(index)){
151+
if(client.admin().cluster().prepareState(TimeValue.ONE_MINUTE).execute().actionGet().getState().getMetadata().hasIndex(index)){
151152
client.admin().indices().prepareDelete(index).get();
152153
}
153154
}
@@ -446,7 +447,7 @@ private static TransportAddress getTransportAddress() throws UnknownHostExceptio
446447
}
447448

448449
private static ElasticsearchTransport getElasticsearchTransport(RestClient restClient) {
449-
RestClientOptions.Builder transportOptionsBuilder = new RestClientOptions(RequestOptions.DEFAULT).toBuilder();
450+
RestClientOptions.Builder transportOptionsBuilder = new RestClientOptions(RequestOptions.DEFAULT, true).toBuilder();
450451

451452
ContentType jsonContentType = Version.VERSION == null ? ContentType.APPLICATION_JSON
452453
: ContentType.create("application/vnd.elasticsearch+json",

0 commit comments

Comments
 (0)