Skip to content

Commit 95d16cb

Browse files
authored
OpenSearch migration for JDBC driver (opensearch-project#3)
* Rename elasticsearch * Change jdbc connection url in comparison IT * Bump plugin version to 1.15 * Rename elasticsearch * Rename more * Rename more
1 parent 0bb88d0 commit 95d16cb

Some content is hidden

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

41 files changed

+381
-385
lines changed

integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/correctness/CorrectnessIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private DBConnection getESConnection(TestConfig config) {
109109
} else {
110110
client = RestClient.builder(HttpHost.create(esHost)).build();
111111
}
112-
return new ESConnection("jdbc:elasticsearch://" + esHost, client);
112+
return new ESConnection("jdbc:opensearch://" + esHost, client);
113113
}
114114

115115
/**

integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/correctness/tests/ESConnectionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class ESConnectionTest {
5252

5353
@Before
5454
public void setUp() throws IOException {
55-
conn = new ESConnection("jdbc:elasticsearch://localhost:12345", client);
55+
conn = new ESConnection("jdbc:opensearch://localhost:12345", client);
5656

5757
Response response = mock(Response.class);
5858
when(client.performRequest(any(Request.class))).thenReturn(response);

integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/sql/CorrectnessTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected void verify(String... queries) {
100100
*/
101101
private DBConnection getESConnection() {
102102
String esHost = client().getNodes().get(0).getHost().toString();
103-
return new ESConnection("jdbc:elasticsearch://" + esHost, client());
103+
return new ESConnection("jdbc:opensearch://" + esHost, client());
104104
}
105105

106106
/**

sql-jdbc/README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Java application that needs to use it.
1313

1414
If using with JDBC compatible BI tools, refer to the tool documentation on configuring a new JDBC driver. Typically,
1515
all that's required is to make the tool aware of the location of the driver jar and then use it to setup database (i.e
16-
Elasticsearch) connections.
16+
OpenSearch) connections.
1717

1818
### Connection URL and other settings
1919

2020
To setup a connection, the driver requires a JDBC connection URL. The connection URL is of the form:
2121
```
22-
jdbc:elasticsearch://[scheme://][host][:port][/context-path]?[property-key=value]&[property-key2=value2]..&[property-keyN=valueN]
22+
jdbc:opensearch://[scheme://][host][:port][/context-path]?[property-key=value]&[property-key2=value2]..&[property-keyN=valueN]
2323
```
2424

2525

@@ -58,11 +58,11 @@ To setup a connection, the driver requires a JDBC connection URL. The connection
5858
| ------------- |-------------| -----|---------|
5959
| user | Connection username. mandatory if `auth` property selects a authentication scheme that mandates a username value | any string | `null` |
6060
| password | Connection password. mandatory if `auth` property selects a authentication scheme that mandates a password value | any string | `null` |
61-
| fetchSize | Cursor page size | positive integer value. Max value is limited by `index.max_result_window` Elasticsearch setting | `0` (for non-paginated response) |
61+
| fetchSize | Cursor page size | positive integer value. Max value is limited by `index.max_result_window` OpenSearch setting | `0` (for non-paginated response) |
6262
| logOutput | location where driver logs should be emitted | a valid file path | `null` (logs are disabled) |
6363
| logLevel | severity level for which driver logs should be emitted | in order from highest(least logging) to lowest(most logging): OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL | OFF (logs are disabled) |
6464
| auth | authentication mechanism to use | `NONE` (no auth), `BASIC` (HTTP Basic), `AWS_SIGV4` (AWS SIGV4) | `basic` if username and/or password is specified, `NONE` otherwise |
65-
| awsCredentialsProvider | The AWS credential provider to be used when authentication mechanism is `AWS_SIGV4` (AWS SIGV4). If not set, the driver will use DefaultAWSCredentialsProviderChain to sign the request. Note that the driver renamed the namespaces of its dependencies, so the value has to be an instance of com.amazonaws.opendistro.elasticsearch.sql.jdbc.shadow.com.amazonaws.auth.AWSCredentialsProvider| Instance of an AWSCredentialProvider | DefaultAWSCredentialsProviderChain |
65+
| awsCredentialsProvider | The AWS credential provider to be used when authentication mechanism is `AWS_SIGV4` (AWS SIGV4). If not set, the driver will use DefaultAWSCredentialsProviderChain to sign the request. Note that the driver renamed the namespaces of its dependencies, so the value has to be an instance of com.amazonaws.opendistro.opensearch.sql.jdbc.shadow.com.amazonaws.auth.AWSCredentialsProvider| Instance of an AWSCredentialProvider | DefaultAWSCredentialsProviderChain |
6666
| region | if authentication type is `aws_sigv4`, then this is the region value to use when signing requests. Only needed if the driver can not determine the region for the host endpoint. The driver will detect the region if the host endpoint matches a known url pattern. | a valid AWS region value e.g. us-east-1 | `null` (auto-detected if possible from the host endpoint) |
6767
| requestCompression | whether to indicate acceptance of compressed (gzip) responses when making server requests | `true` or `false` | `false` |
6868
| useSSL | whether to establish the connection over SSL/TLS | `true` or `false` | `false` if scheme is `http`, `true` if scheme is `https` |
@@ -89,7 +89,7 @@ import java.sql.DriverManager;
8989
import java.sql.Statement;
9090
.
9191
.
92-
String url = "jdbc:elasticsearch://localhost:9200";
92+
String url = "jdbc:opensearch://localhost:9200";
9393
9494
Connection con = DriverManager.getConnection(url);
9595
Statement st = con.createStatement();
@@ -108,7 +108,7 @@ import java.sql.DriverManager;
108108
import java.sql.Statement;
109109
.
110110
.
111-
String url = "jdbc:elasticsearch://https://remote-host-name";
111+
String url = "jdbc:opensearch://https://remote-host-name";
112112
113113
Connection con = DriverManager.getConnection(url);
114114
Statement st = con.createStatement();
@@ -127,7 +127,7 @@ import java.sql.DriverManager;
127127
import java.sql.Statement;
128128
.
129129
.
130-
String url = "jdbc:elasticsearch://remote-host-name";
130+
String url = "jdbc:opensearch://remote-host-name";
131131
132132
Properties properties = new Properties();
133133
properties.put("useSSL", "true");
@@ -149,7 +149,7 @@ import java.sql.DriverManager;
149149
import java.sql.Statement;
150150
.
151151
.
152-
String url = "jdbc:elasticsearch://https://remote-host-name";
152+
String url = "jdbc:opensearch://https://remote-host-name";
153153
String user = "username";
154154
String password = "password";
155155
@@ -170,7 +170,7 @@ import java.sql.DriverManager;
170170
import java.sql.Statement;
171171
.
172172
.
173-
String url = "jdbc:elasticsearch://remote-host-name";
173+
String url = "jdbc:opensearch://remote-host-name";
174174
175175
Properties properties = new Properties();
176176
properties.put("useSSL", "true");
@@ -194,7 +194,7 @@ import java.sql.DriverManager;
194194
import java.sql.Statement;
195195
.
196196
.
197-
String url = "jdbc:elasticsearch://remote-host-name";
197+
String url = "jdbc:opensearch://remote-host-name";
198198
199199
Properties properties = new Properties();
200200
properties.put("useSSL", "true");
@@ -224,7 +224,7 @@ import java.sql.DriverManager;
224224
import java.sql.Statement;
225225
.
226226
.
227-
String url = "jdbc:elasticsearch://https://remote-host-name?auth=aws_sigv4";
227+
String url = "jdbc:opensearch://https://remote-host-name?auth=aws_sigv4";
228228
229229
Connection con = DriverManager.getConnection(url);
230230
Statement st = con.createStatement();
@@ -242,7 +242,7 @@ import java.sql.DriverManager;
242242
import java.sql.Statement;
243243
.
244244
.
245-
String url = "jdbc:elasticsearch://https://remote-host-name";
245+
String url = "jdbc:opensearch://https://remote-host-name";
246246
247247
Properties properties = new Properties();
248248
properties.put("auth", "aws_sigv4");
@@ -264,7 +264,7 @@ import java.sql.DriverManager;
264264
import java.sql.Statement;
265265
.
266266
.
267-
String url = "jdbc:elasticsearch://https://remote-host-name";
267+
String url = "jdbc:opensearch://https://remote-host-name";
268268
269269
Properties properties = new Properties();
270270
properties.put("awsCredentialsProvider", new EnvironmentVariableCredentialsProvider());
@@ -286,7 +286,7 @@ import java.sql.DriverManager;
286286
import java.sql.Statement;
287287
.
288288
.
289-
String url = "jdbc:elasticsearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
289+
String url = "jdbc:opensearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
290290
291291
Connection con = DriverManager.getConnection(url);
292292
Statement st = con.createStatement();
@@ -305,7 +305,7 @@ import java.sql.DriverManager;
305305
import java.sql.Statement;
306306
.
307307
.
308-
String url = "jdbc:elasticsearch://https://remote-host-name";
308+
String url = "jdbc:opensearch://https://remote-host-name";
309309
310310
Properties properties = new Properties();
311311
properties.put("auth", "aws_sigv4");
@@ -321,7 +321,7 @@ con.close();
321321
```
322322
### Connecting using the DataSource interface
323323

324-
The driver also provides a javax.sql.DataSource implementation via the `com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource` class that can be used to obtain a connection. Here are some typical code samples:
324+
The driver also provides a javax.sql.DataSource implementation via the `com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource` class that can be used to obtain a connection. Here are some typical code samples:
325325

326326

327327
* Connect to localhost on port 9200 with no authentication over a plain connection
@@ -331,13 +331,13 @@ import java.sql.Connection;
331331
import java.sql.Statement;
332332
import javax.sql.DataSource;
333333
334-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
334+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
335335
336336
.
337337
.
338-
String url = "jdbc:elasticsearch://localhost:9200";
338+
String url = "jdbc:opensearch://localhost:9200";
339339
340-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
340+
OpenSearchDataSource ds = new OpenSearchDataSource();
341341
ds.setUrl(url);
342342
343343
Connection con = ds.getConnection(url);
@@ -356,13 +356,13 @@ import java.sql.Connection;
356356
import java.sql.Statement;
357357
import javax.sql.DataSource;
358358
359-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
359+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
360360
361361
.
362362
.
363-
String url = "jdbc:elasticsearch://https://remote-host-name";
363+
String url = "jdbc:opensearch://https://remote-host-name";
364364
365-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
365+
OpenSearchDataSource ds = new OpenSearchDataSource();
366366
ds.setUrl(url);
367367
368368
Connection con = ds.getConnection(url);
@@ -381,13 +381,13 @@ import java.sql.Connection;
381381
import java.sql.Statement;
382382
import javax.sql.DataSource;
383383
384-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
384+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
385385
386386
.
387387
.
388-
String url = "jdbc:elasticsearch://https://remote-host-name";
388+
String url = "jdbc:opensearch://https://remote-host-name";
389389
390-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
390+
OpenSearchDataSource ds = new OpenSearchDataSource();
391391
ds.setUrl(url);
392392
393393
Connection con = ds.getConnection(url, "user", "password");
@@ -407,13 +407,13 @@ import java.sql.Connection;
407407
import java.sql.Statement;
408408
import javax.sql.DataSource;
409409
410-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
410+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
411411
412412
.
413413
.
414-
String url = "jdbc:elasticsearch://https://remote-host-name?auth=aws_sigv4";
414+
String url = "jdbc:opensearch://https://remote-host-name?auth=aws_sigv4";
415415
416-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
416+
OpenSearchDataSource ds = new OpenSearchDataSource();
417417
ds.setUrl(url);
418418
419419
Connection con = ds.getConnection(url);
@@ -432,13 +432,13 @@ import java.sql.Connection;
432432
import java.sql.Statement;
433433
import javax.sql.DataSource;
434434
435-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
435+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
436436
437437
.
438438
.
439-
String url = "jdbc:elasticsearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
439+
String url = "jdbc:opensearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
440440
441-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
441+
OpenSearchDataSource ds = new OpenSearchDataSource();
442442
ds.setUrl(url);
443443
ds.setAwsCredentialProvider(new EnvironmentVariableCredentialsProvider());
444444
@@ -458,13 +458,13 @@ import java.sql.Connection;
458458
import java.sql.Statement;
459459
import javax.sql.DataSource;
460460
461-
import com.amazon.opendistroforelasticsearch.jdbc.ElasticsearchDataSource;
461+
import com.amazon.opendistroforelasticsearch.jdbc.OpenSearchDataSource;
462462
463463
.
464464
.
465-
String url = "jdbc:elasticsearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
465+
String url = "jdbc:opensearch://https://remote-host-name?auth=aws_sigv4&region=us-west-1";
466466
467-
ElasticsearchDataSource ds = new ElasticsearchDataSource();
467+
OpenSearchDataSource ds = new OpenSearchDataSource();
468468
ds.setUrl(url);
469469
470470
Connection con = ds.getConnection(url);

sql-jdbc/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ plugins {
3232
group 'com.amazon.opendistroforelasticsearch.client'
3333

3434
// keep version in sync with version in Driver source
35-
version '1.13.0.0'
35+
version '1.15.0.0'
3636

3737
boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true"));
3838
if (snapshot) {
@@ -71,7 +71,7 @@ tasks.withType(JavaCompile) {
7171
}
7272

7373
static def getShadowPath(String path) {
74-
return 'com.amazonaws.opendistro.elasticsearch.sql.jdbc.shadow.' + path
74+
return 'com.amazonaws.opendistro.opensearch.sql.jdbc.shadow.' + path
7575
}
7676

7777
shadowJar {

sql-jdbc/docs/tableau.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ Place the `opendistro-sql-jdbc-x.x.x.x.jar` file in the folder for your operatin
2020

2121
### Create TDC file
2222

23-
TDC file is required to add customization for the data connection. For reference, see the following sample `elasticsearch.tdc` file.
23+
TDC file is required to add customization for the data connection. For reference, see the following sample `opensearch.tdc` file.
2424
```
2525
<?xml version='1.0' encoding='utf-16' ?>
2626
<connection-customization class='genericjdbc' enabled='true' version='2019.3'>
2727
<vendor name='genericjdbc' />
28-
<driver name='elasticsearch' />
28+
<driver name='opensearch' />
2929
<customizations>
3030
<customization name='CAP_CREATE_TEMP_TABLES' value='no'/>
3131
<customization name='CAP_SUPPRESS_DISCOVERY_QUERIES' value='yes' />
@@ -39,7 +39,7 @@ TDC file is required to add customization for the data connection. For reference
3939
</connection-customization>
4040
```
4141
* Using a text editor, add `<connection-customization>` section.
42-
* Name the file `elasticsearch.tdc` and save it to `My Tableau Repository\Datasources`.
42+
* Name the file `opensearch.tdc` and save it to `My Tableau Repository\Datasources`.
4343
* Restart Tableau to apply the change.
4444

4545
For futher details check [using a .tdc file with Tableau](https://kb.tableau.com/articles/howto/using-a-tdc-file-with-tableau-server)
@@ -49,11 +49,11 @@ For futher details check [using a .tdc file with Tableau](https://kb.tableau.com
4949
You will need:
5050
* [JDBC connection string](https://github.com/opendistro-for-elasticsearch/sql/blob/master/sql-jdbc/README.md#connection-url-and-other-settings) to enter in the URL field when you connect.
5151

52-
Sample connection string for connecting to localhost: `jdbc:elasticsearch://localhost:9200`.
52+
Sample connection string for connecting to localhost: `jdbc:opensearch://localhost:9200`.
5353

5454
* Credentials for signing in to the server (user name and password).
5555
* (Optional) JDBC properties file to customize the driver behavior. For more details check [Customize JDBC Connections Using a Properties File](https://community.tableau.com/docs/DOC-17978)
56-
* Create a properties file called `elasticsearch.properties`.
56+
* Create a properties file called `opensearch.properties`.
5757
* Save the file to the `My Tableau Repository\Datasources` directory.
5858

5959

sql-jdbc/src/main/java/com/amazon/opendistroforelasticsearch/jdbc/ConnectionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import java.util.Properties;
5656
import java.util.concurrent.Executor;
5757

58-
public class ConnectionImpl implements ElasticsearchConnection, JdbcWrapper, LoggingSource {
58+
public class ConnectionImpl implements OpenSearchConnection, JdbcWrapper, LoggingSource {
5959

6060
private String url;
6161
private String user;

0 commit comments

Comments
 (0)