Skip to content

Commit

Permalink
Tie into manually edited client
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Aug 26, 2024
1 parent 0caa844 commit 27c92fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
12 changes: 12 additions & 0 deletions java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ java {
}
}

sourceSets {
main {
java {
srcDir("src/generated/java")
}
}
}

tasks.withType<ProcessResources> {
expand(
"version" to version,
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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\"},"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 27c92fa

Please sign in to comment.