Skip to content

Commit

Permalink
Generate the ml namespace (opensearch-project#1158)
Browse files Browse the repository at this point in the history
* Generate ml.register_model_group

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Start neural search sample

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Re-generate ShardStatistics

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Re-generate ShardFailure

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Re-generate Result

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Re-generate WriteResponseBase

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.delete_model_group

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.register_model

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Exclude legacy license from ml namespace

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.get_task

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.delete_task

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.delete_model

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.deploy_model

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.undeploy_model

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Complete neural search sample

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Generate ml.get_model

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Add changelog entry

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* note

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

* Fix tests

Signed-off-by: Thomas Farr <tsfarr@amazon.com>

---------

Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia authored Aug 26, 2024
1 parent eb14e3f commit c6e61e1
Show file tree
Hide file tree
Showing 48 changed files with 4,110 additions and 234 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
- Migrate client transports to Apache HttpClient / Core 5.x ([#246](https://github.com/opensearch-project/opensearch-java/pull/246))
- Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769))
- Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124))
- Changed type of `ShardStatistics`'s `total`, `successful`, `failed` & `skipped` fields from `Number` to `int/Integer` ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158))

### Deprecated
- Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536))
Expand All @@ -36,8 +37,9 @@ This section is for maintaining a changelog for all breaking changes for the cli
## [Unreleased 2.x]

### Added
- Adds `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138))
- Adds `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147))
- Added `queryImage` (query_image) field to `NeuralQuery`, following definition in ([Neural Query](https://opensearch.org/docs/latest/query-dsl/specialized/neural/)) ([#1137](https://github.com/opensearch-project/opensearch-java/pull/1138))
- Added `cancelAfterTimeInterval` to `SearchRequest` and `MsearchRequest` ([#1147](https://github.com/opensearch-project/opensearch-java/pull/1147))
- Added the `ml` namespace operations ([#1158](https://github.com/opensearch-project/opensearch-java/pull/1158))

### Dependencies

Expand Down
6 changes: 5 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ After:
```

### DanglingIndex creationDateMillis type
- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`.
- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`.

### ShardStatistics properties types
- The type of the `total`, `successful` and `failed` fields has been corrected from `Number` to `int`.
- The type of the `skipped` field has been corrected from `Number` to `Integer`.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

Expand Down Expand Up @@ -71,6 +72,10 @@ public OpenSearchDanglingIndicesAsyncClient danglingIndices() {
return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions);
}

public OpenSearchMlAsyncClient ml() {
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient;
import org.opensearch.client.opensearch.ml.OpenSearchMlClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

Expand Down Expand Up @@ -70,6 +71,10 @@ public OpenSearchDanglingIndicesClient danglingIndices() {
return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions);
}

public OpenSearchMlClient ml() {
return new OpenSearchMlClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,30 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import javax.annotation.Generated;
import org.opensearch.client.json.JsonEnum;
import org.opensearch.client.json.JsonpDeserializable;

// typedef: _types.Result

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public enum Result implements JsonEnum {
Created("created"),

Updated("updated"),

Deleted("deleted"),

NotFound("not_found"),

NoOp("noop"),

;
NotFound("not_found"),

Updated("updated");

private final String jsonValue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
Expand All @@ -48,7 +53,9 @@
// typedef: _types.ShardFailure

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class ShardFailure implements PlainJsonSerializable {

@Nullable
private final String index;

Expand All @@ -65,16 +72,14 @@ public class ShardFailure implements PlainJsonSerializable {
// ---------------------------------------------------------------------------------------------

private ShardFailure(Builder builder) {

this.index = builder.index;
this.node = builder.node;
this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason");
this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard");
this.status = builder.status;

}

public static ShardFailure of(Function<Builder, ObjectBuilder<ShardFailure>> fn) {
public static ShardFailure of(Function<ShardFailure.Builder, ObjectBuilder<ShardFailure>> fn) {
return fn.apply(new Builder()).build();
}

Expand Down Expand Up @@ -119,24 +124,24 @@ public final String status() {
/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

if (this.index != null) {
generator.writeKey("index");
generator.write(this.index);

}

if (this.node != null) {
generator.writeKey("node");
generator.write(this.node);

}

generator.writeKey("reason");
this.reason.serialize(generator, mapper);

Expand All @@ -146,28 +151,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.status != null) {
generator.writeKey("status");
generator.write(this.status);

}

}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link ShardFailure}.
*/

public static class Builder extends ObjectBuilderBase implements ObjectBuilder<ShardFailure> {
@Nullable
private String index;

@Nullable
private String node;

private ErrorCause reason;

private Integer shard;

@Nullable
private String status;

Expand Down Expand Up @@ -199,7 +197,7 @@ public final Builder reason(ErrorCause value) {
* Required - API name: {@code reason}
*/
public final Builder reason(Function<ErrorCause.Builder, ObjectBuilder<ErrorCause>> fn) {
return this.reason(fn.apply(new ErrorCause.Builder()).build());
return reason(fn.apply(new ErrorCause.Builder()).build());
}

/**
Expand All @@ -221,16 +219,14 @@ public final Builder status(@Nullable String value) {
/**
* Builds a {@link ShardFailure}.
*
* @throws NullPointerException
* if some of the required fields are null.
* @throws NullPointerException if some of the required fields are null.
*/
public ShardFailure build() {
_checkSingleUse();

return new ShardFailure(this);
}
}

// ---------------------------------------------------------------------------------------------

/**
Expand All @@ -242,13 +238,10 @@ public ShardFailure build() {
);

protected static void setupShardFailureDeserializer(ObjectDeserializer<ShardFailure.Builder> op) {

op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node");
op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason");
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard");
op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status");

}

}
Loading

0 comments on commit c6e61e1

Please sign in to comment.