From 4344d5c58b68e22e06c1338150f08fbf943344d0 Mon Sep 17 00:00:00 2001 From: Marius Posta Date: Wed, 14 Feb 2024 11:53:47 -0800 Subject: [PATCH] source-elasticsearch: adopt CDK 0.20.4 (#35230) --- .../connectors/source-elasticsearch/build.gradle | 16 +++------------- .../source-elasticsearch/metadata.yaml | 2 +- .../elasticsearch/ElasticsearchConnection.java | 3 ++- .../ElasticsearchSourceAcceptanceTest.java | 3 ++- docs/integrations/sources/elasticsearch.md | 1 + 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/airbyte-integrations/connectors/source-elasticsearch/build.gradle b/airbyte-integrations/connectors/source-elasticsearch/build.gradle index 31f1cfca5fcc..be2a7153ed4a 100644 --- a/airbyte-integrations/connectors/source-elasticsearch/build.gradle +++ b/airbyte-integrations/connectors/source-elasticsearch/build.gradle @@ -1,23 +1,13 @@ plugins { - id 'application' id 'airbyte-java-connector' } airbyteJavaConnector { - cdkVersionRequired = '0.2.0' + cdkVersionRequired = '0.20.4' features = ['db-sources'] useLocalCdk = false } -//remove once upgrading the CDK version to 0.4.x or later -java { - compileJava { - options.compilerArgs.remove("-Werror") - } -} - -airbyteJavaConnector.addCdkDependencies() - application { mainClass = 'io.airbyte.integrations.source.elasticsearch.ElasticsearchSource' applicationDefaultJvmArgs = ['-XX:+ExitOnOutOfMemoryError', '-XX:MaxRAMPercentage=75.0'] @@ -26,6 +16,7 @@ application { dependencies { implementation 'co.elastic.clients:elasticsearch-java:7.15.0' + implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:7.15.2' implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.3' // EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 @@ -39,6 +30,5 @@ dependencies { // MIT // https://www.testcontainers.org/ - testImplementation libs.testcontainers.elasticsearch - integrationTestJavaImplementation libs.testcontainers.elasticsearch + testImplementation 'org.testcontainers:elasticsearch:1.19.4' } diff --git a/airbyte-integrations/connectors/source-elasticsearch/metadata.yaml b/airbyte-integrations/connectors/source-elasticsearch/metadata.yaml index 1c7dad3da8d3..887dc9c9fa35 100644 --- a/airbyte-integrations/connectors/source-elasticsearch/metadata.yaml +++ b/airbyte-integrations/connectors/source-elasticsearch/metadata.yaml @@ -2,7 +2,7 @@ data: connectorSubtype: api connectorType: source definitionId: 7cf88806-25f5-4e1a-b422-b2fa9e1b0090 - dockerImageTag: 0.1.1 + dockerImageTag: 0.1.2 dockerRepository: airbyte/source-elasticsearch githubIssueLabel: source-elasticsearch icon: elasticsearch.svg diff --git a/airbyte-integrations/connectors/source-elasticsearch/src/main/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchConnection.java b/airbyte-integrations/connectors/source-elasticsearch/src/main/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchConnection.java index 15ea98bc4d74..a745fda1db93 100644 --- a/airbyte-integrations/connectors/source-elasticsearch/src/main/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchConnection.java +++ b/airbyte-integrations/connectors/source-elasticsearch/src/main/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchConnection.java @@ -21,7 +21,7 @@ import org.elasticsearch.client.indices.GetMappingsRequest; import org.elasticsearch.client.indices.GetMappingsResponse; import org.elasticsearch.cluster.metadata.MappingMetadata; -import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.core.TimeValue; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.search.Scroll; import org.elasticsearch.search.SearchHit; @@ -44,6 +44,7 @@ public class ElasticsearchConnection { * * @param config Configuration parameters for connecting to the Elasticsearch host */ + @SuppressWarnings("this-escape") public ElasticsearchConnection(ConnectorConfiguration config) { log.info(String.format( "creating ElasticsearchConnection: %s", config.getEndpoint())); diff --git a/airbyte-integrations/connectors/source-elasticsearch/src/test-integration/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchSourceAcceptanceTest.java b/airbyte-integrations/connectors/source-elasticsearch/src/test-integration/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchSourceAcceptanceTest.java index 980a71a9c016..83b7db8cc7a0 100644 --- a/airbyte-integrations/connectors/source-elasticsearch/src/test-integration/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchSourceAcceptanceTest.java +++ b/airbyte-integrations/connectors/source-elasticsearch/src/test-integration/java/io/airbyte/integrations/source/elasticsearch/ElasticsearchSourceAcceptanceTest.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.airbyte.cdk.integrations.standardtest.source.SourceAcceptanceTest; import io.airbyte.cdk.integrations.standardtest.source.TestDestinationEnv; +import io.airbyte.cdk.integrations.util.HostPortResolver; import io.airbyte.commons.jackson.MoreMappers; import io.airbyte.commons.json.Jsons; import io.airbyte.commons.resources.MoreResources; @@ -47,7 +48,7 @@ protected String getImageName() { @Override protected JsonNode getConfig() { var configJson = mapper.createObjectNode(); - configJson.put("endpoint", String.format("http://%s:%s", container.getHost(), container.getMappedPort(9200))); + configJson.put("endpoint", String.format("http://%s:%s", HostPortResolver.resolveHost(container), HostPortResolver.resolvePort(container))); return configJson; } diff --git a/docs/integrations/sources/elasticsearch.md b/docs/integrations/sources/elasticsearch.md index d029188f1915..2aa1a3fbb617 100644 --- a/docs/integrations/sources/elasticsearch.md +++ b/docs/integrations/sources/elasticsearch.md @@ -84,6 +84,7 @@ all values in the array must be of the same data type. Hence, every field can be | Version | Date | Pull Request | Subject | |:--------| :--------- | :------------------------------------------------------- | :-------------- | +| 0.1.2 | 2024-02-13 | [35230](https://github.com/airbytehq/airbyte/pull/35230) | Adopt CDK 0.20.4 | | `0.1.2` | 2024-01-24 | [34453](https://github.com/airbytehq/airbyte/pull/34453) | bump CDK version | | `0.1.1` | 2022-12-02 | [18118](https://github.com/airbytehq/airbyte/pull/18118) | Avoid too_long_frame_exception | | `0.1.0` | 2022-07-12 | [14118](https://github.com/airbytehq/airbyte/pull/14118) | Initial Release |