opensearch-project / opensearch-java

Java Client for OpenSearch
Apache License 2.0
124 stars 183 forks source link

[BUG] Java Client SDK RestoreIndex is throwing Missing required property 'RestoreResponse.snapshot' #930

Open shasti421 opened 7 months ago

shasti421 commented 7 months ago

Attached code is throwing error with AWS OpenSearch, but index is getting restored as expected.

            RestoreRequest.Builder builder = new RestoreRequest.Builder();
            builder.repository(repoName);
            builder.snapshot(snapshotName);
            builder.indices(Arrays.asList(settings.get("indices").split(",")));
            builder.partial(false);
            return openSearchClient.snapshot().restore(builder.build());
org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'RestoreResponse.snapshot'
    at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89)
    at org.opensearch.client.opensearch.snapshot.RestoreResponse.<init>(RestoreResponse.java:58)
    at org.opensearch.client.opensearch.snapshot.RestoreResponse.<init>(RestoreResponse.java:51)
    at org.opensearch.client.opensearch.snapshot.RestoreResponse$Builder.build(RestoreResponse.java:122)
    at org.opensearch.client.opensearch.snapshot.RestoreResponse$Builder.build(RestoreResponse.java:95)
    at org.opensearch.client.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:92)
    at org.opensearch.client.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:55)

Do you have any screenshots?

See attached stack trace above

Do you have any additional context?

Using client version 2.9.1

shasti421 commented 7 months ago

Similar error happening with

                       CreateSnapshotRequest.Builder builder = new CreateSnapshotRequest.Builder();
            builder.repository(repoName);
            builder.snapshot(snapshotName);
            return openSearchClient.snapshot().create(builder.build());
org.opensearch.client.util.MissingRequiredPropertyException: Missing required property 'CreateSnapshotResponse.snapshot'
at org.opensearch.client.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:89)
at org.opensearch.client.opensearch.snapshot.CreateSnapshotResponse.<init>(CreateSnapshotResponse.java:62)
dblock commented 6 months ago

@shasti421 Is this specific to AWS, or does this happen with vanilla OpenSearch? Also can you reproduce this with curl or is it a client problem?