opensearch-java icon indicating copy to clipboard operation
opensearch-java copied to clipboard

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

Open shasti421 opened this issue 1 year ago • 2 comments

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 avatar Apr 09 '24 20:04 shasti421

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)

shasti421 avatar Apr 10 '24 16:04 shasti421

@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?

dblock avatar Apr 16 '24 16:04 dblock