From 27c92fa0b0cd99081b81d2d63e2d107204e8dfb4 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 27 Aug 2024 10:21:41 +1200 Subject: [PATCH] Tie into manually edited client Signed-off-by: Thomas Farr --- java-client/build.gradle.kts | 12 ++++++++++++ .../client/opensearch/OpenSearchAsyncClient.java | 5 +++++ .../client/opensearch/OpenSearchClient.java | 5 +++++ .../client/opensearch/model/TypedKeysTest.java | 4 ++-- .../client/samples/neural/NeuralSearch.java | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index 1fc18b2412..1243aad67e 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -84,6 +84,14 @@ java { } } +sourceSets { + main { + java { + srcDir("src/generated/java") + } + } +} + tasks.withType { expand( "version" to version, @@ -186,6 +194,10 @@ dependencies { // http://json-b.net/ implementation("jakarta.json.bind", "jakarta.json.bind-api", "2.0.0") + // EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + // https://projects.eclipse.org/projects/ee4j.ca + implementation("jakarta.annotation", "jakarta.annotation-api", "1.3.5") + // Apache 2.0 implementation("com.fasterxml.jackson.core", "jackson-core", jacksonVersion) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 5d869c6f59..e67d6148f7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -126,6 +126,7 @@ import org.opensearch.client.opensearch.features.OpenSearchFeaturesAsyncClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesAsyncClient; import org.opensearch.client.opensearch.ingest.OpenSearchIngestAsyncClient; +import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; import org.opensearch.client.opensearch.nodes.OpenSearchNodesAsyncClient; import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownAsyncClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; @@ -181,6 +182,10 @@ public OpenSearchIngestAsyncClient ingest() { return new OpenSearchIngestAsyncClient(this.transport, this.transportOptions); } + public OpenSearchMlAsyncClient ml() { + return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); + } + public OpenSearchNodesAsyncClient nodes() { return new OpenSearchNodesAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java index ee83bcc20d..a16c771822 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -126,6 +126,7 @@ import org.opensearch.client.opensearch.generic.OpenSearchGenericClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesClient; import org.opensearch.client.opensearch.ingest.OpenSearchIngestClient; +import org.opensearch.client.opensearch.ml.OpenSearchMlClient; import org.opensearch.client.opensearch.nodes.OpenSearchNodesClient; import org.opensearch.client.opensearch.shutdown.OpenSearchShutdownClient; import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; @@ -184,6 +185,10 @@ public OpenSearchIngestClient ingest() { return new OpenSearchIngestClient(this.transport, this.transportOptions); } + public OpenSearchMlClient ml() { + return new OpenSearchMlClient(this.transport, this.transportOptions); + } + public OpenSearchNodesClient nodes() { return new OpenSearchNodesClient(this.transport, this.transportOptions); } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java index 3472db587c..df69bc98a7 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/TypedKeysTest.java @@ -57,7 +57,7 @@ public void testMapProperty() { .timedOut(false) .build(); - String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0,\"successful\":1,\"total\":1}," + String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0.0,\"successful\":1.0,\"total\":1.0}," + "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]},\"aggregations\":{\"avg#foo\":{\"value\":3.14}}}"; assertEquals(json, toJson(resp)); @@ -95,7 +95,7 @@ public void testAdditionalProperties() { .timedOut(false) .build(); - String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0,\"successful\":1,\"total\":1}," + String json = "{\"took\":1,\"timed_out\":false,\"_shards\":{\"failed\":0.0,\"successful\":1.0,\"total\":1.0}," + "\"hits\":{\"total\":{\"relation\":\"eq\",\"value\":0},\"hits\":[]}," + "\"aggregations\":{\"sterms#foo\":{\"buckets\":[" + "{\"avg#bar\":{\"value\":1.0},\"doc_count\":1,\"key\":\"key_1\"}," diff --git a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java index 263adb1475..3036ef2c89 100644 --- a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java +++ b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java @@ -39,7 +39,7 @@ */ public class NeuralSearch { private static final String SAMPLE_NAME = "neural-search"; - private static final String RESOURCE_NAME_PREFIX = "csharp-" + SAMPLE_NAME; + private static final String RESOURCE_NAME_PREFIX = "java-" + SAMPLE_NAME; private static final String ML_MODEL_GROUP_NAME = RESOURCE_NAME_PREFIX + "-model-group"; private static final String INGEST_PIPELINE_NAME = RESOURCE_NAME_PREFIX + "-ingest-pipeline"; private static final String INDEX_NAME = RESOURCE_NAME_PREFIX + "-index";