Skip to content

Commit 22ff099

Browse files
authored
Merge branch 'master' into elasticsearch-sql-jdbc
2 parents 651ffa2 + c69f4d2 commit 22ff099

File tree

83 files changed

+2386
-1213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2386
-1213
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ before_install:
1717
# update to java 8
1818
- sudo update-java-alternatives -s java-8-oracle
1919
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle
20-
- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.2.deb && sudo dpkg -i --force-confnew elasticsearch-5.1.2.deb
20+
- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.deb && sudo dpkg -i --force-confnew elasticsearch-6.3.2.deb
2121
- sudo cp ./src/test/resources/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml
2222
- sudo cat /etc/elasticsearch/elasticsearch.yml
2323
- sudo java -version

README.md

Lines changed: 329 additions & 14 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 50 additions & 11 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>5.1.2.0</version>
6+
<version>6.3.2.2</version>
77
<packaging>jar</packaging>
88
<description>Query elasticsearch using SQL</description>
99
<name>elasticsearch-sql</name>
@@ -45,12 +45,22 @@
4545
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4646
<runSuite>**/MainTestSuite.class</runSuite>
4747
<elasticsearch.plugin.name>sql</elasticsearch.plugin.name>
48-
<elasticsearch.plugin.site>true</elasticsearch.plugin.site>
49-
<elasticsearch.plugin.jvm>true</elasticsearch.plugin.jvm>
50-
<elasticsearch.version>5.1.2</elasticsearch.version>
48+
<elasticsearch.version>6.3.2</elasticsearch.version>
5149
<elasticsearch.plugin.classname>org.elasticsearch.plugin.nlpcn.SqlPlug</elasticsearch.plugin.classname>
5250
</properties>
5351

52+
<repositories>
53+
<repository>
54+
<id>elasticsearch-releases</id>
55+
<url>https://artifacts.elastic.co/maven</url>
56+
<releases>
57+
<enabled>true</enabled>
58+
</releases>
59+
<snapshots>
60+
<enabled>false</enabled>
61+
</snapshots>
62+
</repository>
63+
</repositories>
5464

5565
<dependencies>
5666
<dependency>
@@ -83,14 +93,15 @@
8393
<dependency>
8494
<groupId>org.locationtech.spatial4j</groupId>
8595
<artifactId>spatial4j</artifactId>
86-
<version>0.6</version>
96+
<version>0.7</version>
8797
</dependency>
8898

89-
<dependency>
90-
<groupId>com.vividsolutions</groupId>
91-
<artifactId>jts</artifactId>
92-
<version>1.13</version>
93-
</dependency>
99+
<dependency>
100+
<groupId>org.locationtech.jts</groupId>
101+
<artifactId>jts-core</artifactId>
102+
<version>1.15.0</version>
103+
<scope>provided</scope>
104+
</dependency>
94105

95106
<dependency>
96107
<groupId>org.elasticsearch</groupId>
@@ -101,11 +112,25 @@
101112

102113
<dependency>
103114
<groupId>org.elasticsearch.client</groupId>
104-
<artifactId>transport</artifactId>
115+
<artifactId>x-pack-transport</artifactId>
105116
<version>${elasticsearch.version}</version>
106117
<scope>provided</scope>
107118
</dependency>
108119

120+
<dependency>
121+
<groupId>com.unboundid</groupId>
122+
<artifactId>unboundid-ldapsdk</artifactId>
123+
<version>3.2.0</version>
124+
<scope>provided</scope>
125+
</dependency>
126+
127+
<dependency>
128+
<groupId>org.bouncycastle</groupId>
129+
<artifactId>bcprov-jdk15on</artifactId>
130+
<version>1.58</version>
131+
<scope>provided</scope>
132+
</dependency>
133+
109134
<dependency>
110135
<groupId>log4j</groupId>
111136
<artifactId>log4j</artifactId>
@@ -213,6 +238,20 @@
213238
<configuration>
214239
<artifactItems>
215240
<artifactItem>
241+
<groupId>org.elasticsearch.plugin</groupId>
242+
<artifactId>parent-join-client</artifactId>
243+
<version>${elasticsearch.version}</version>
244+
<overWrite>false</overWrite>
245+
<outputDirectory>${project.build.directory}</outputDirectory>
246+
</artifactItem>
247+
<artifactItem>
248+
<groupId>org.elasticsearch.plugin</groupId>
249+
<artifactId>reindex-client</artifactId>
250+
<version>${elasticsearch.version}</version>
251+
<overWrite>false</overWrite>
252+
<outputDirectory>${project.build.directory}</outputDirectory>
253+
</artifactItem>
254+
<artifactItem>
216255
<groupId>com.alibaba</groupId>
217256
<artifactId>druid</artifactId>
218257
<overWrite>false</overWrite>

src/_site/controllers.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ $scope.fetchAll = function(){
129129
})
130130
.error(function(data, status, headers, config) {
131131
if(data == "") {
132-
$scope.error = "Error occured! response is not avalible.";
132+
$scope.error = "Error occured! response is not available.";
133133
}
134134
else {
135135
$scope.error = JSON.stringify(data);
@@ -217,7 +217,7 @@ function updateWithScrollIfNeeded (query) {
217217
})
218218
.error(function(data, status, headers, config) {
219219
if(data == "") {
220-
$scope.error = "Error occured! response is not avalible.";
220+
$scope.error = "Error occured! response is not available.";
221221
}
222222
else {
223223
$scope.error = JSON.stringify(data);
@@ -256,7 +256,7 @@ function updateWithScrollIfNeeded (query) {
256256
.error(function(data, status, headers, config) {
257257
$scope.resultExplan = false;
258258
if(data == "") {
259-
$scope.error = "Error occured! response is not avalible.";
259+
$scope.error = "Error occured! response is not available.";
260260
}
261261
else {
262262
$scope.error = JSON.stringify(data);
@@ -350,7 +350,7 @@ function updateWithScrollIfNeeded (query) {
350350
})
351351
.error(function(data, status, headers, config) {
352352
if(data == "") {
353-
$scope.error = "Error occured! response is not avalible.";
353+
$scope.error = "Error occured! response is not available.";
354354
}
355355
else {
356356
$scope.error = JSON.stringify(data);
@@ -425,4 +425,4 @@ function updateWithScrollIfNeeded (query) {
425425
function saveUrl() {
426426
localStorage.setItem("lasturl", $scope.url);
427427
}
428-
});
428+
});

src/assembly/zip.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<formats>
77
<format>zip</format>
88
</formats>
9+
<includeBaseDirectory>false</includeBaseDirectory>
910
<fileSets>
1011
<fileSet>
1112
<directory>${project.basedir}/src/_site</directory>

src/main/java/com/alibaba/druid/pool/ElasticSearchConnection.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import org.elasticsearch.client.Client;
44
import org.elasticsearch.client.transport.TransportClient;
55
import org.elasticsearch.common.settings.Settings;
6-
import org.elasticsearch.common.transport.InetSocketTransportAddress;
7-
import org.elasticsearch.transport.client.PreBuiltTransportClient;
6+
import org.elasticsearch.common.transport.TransportAddress;
7+
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
88

99
import java.io.InputStream;
1010
import java.io.Reader;
@@ -24,20 +24,21 @@ public class ElasticSearchConnection implements Connection {
2424

2525
private Client client;
2626

27-
public ElasticSearchConnection(String jdbcUrl) {
27+
public ElasticSearchConnection(String jdbcUrl, Properties info) {
2828

29-
30-
Settings settings = Settings.builder().put("client.transport.ignore_cluster_name", true).build();
29+
Settings.Builder builder = Settings.builder();
30+
info.forEach((k, v) -> builder.put(k.toString(), v.toString()));
31+
Settings settings = builder.build();
3132
try {
32-
TransportClient transportClient = new PreBuiltTransportClient(settings);
33+
TransportClient transportClient = new PreBuiltXPackTransportClient(settings);
3334

3435
String hostAndPortArrayStr = jdbcUrl.split("/")[2];
3536
String[] hostAndPortArray = hostAndPortArrayStr.split(",");
3637

3738
for (String hostAndPort : hostAndPortArray) {
3839
String host = hostAndPort.split(":")[0];
3940
String port = hostAndPort.split(":")[1];
40-
transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), Integer.parseInt(port)));
41+
transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName(host), Integer.parseInt(port)));
4142
}
4243
client = transportClient;
4344
} catch (UnknownHostException e) {

src/main/java/com/alibaba/druid/pool/ElasticSearchDruidDataSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ public Connection createPhysicalConnection() throws SQLException {
655655

656656
@Override
657657
public Connection createPhysicalConnection(String url, Properties info) throws SQLException {
658-
Connection conn = new ElasticSearchConnection(url);
658+
Connection conn = new ElasticSearchConnection(url, info);
659659
createCount.incrementAndGet();
660660

661661
return conn;

0 commit comments

Comments
 (0)