elastic / elastic/elasticsearch-java
[es/snapshot.restore] Missing required property 'RestoreResponse.snapshot' with wait_for_completion=false
- Dominant language
- Java
- Stars
- 524
- Forks
- 300
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 16
Description
### Java API client version
7.16.2 and 7.17.1
### Java version
java 11.0.14 2022-01-18 LTS
### Elasticsearch Version
7.16.2
### Problem description
Running snapshot restore with wait_for_completion=false does not work with the Java client.
Call:
```java
client
.snapshot()
.restore(r -> r
.repository(snapshotRepositoryName)
.snapshot(snapshotName)
.indices(globPatterns)
.renamePattern(renamePattern.getSearchRegex())
.renameReplacement(renamePattern.getReplacementRegex())
.includeAliases(false)
.waitForCompletion(false)
```
Results in URI:
```
/_snapshot/myRepoName/cloud-snapshot-2022.02.23-asdf/_restore?wait_for_completion=false
```
Error:
```java
co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'RestoreResponse.snapshot'
at co.elastic.clients.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:76)
at co.elastic.clients.elasticsearch.snapshot.RestoreResponse.(RestoreResponse.java:57)
at co.elastic.clients.elasticsearch.snapshot.RestoreResponse.(RestoreResponse.java:50)
at co.elastic.clients.elasticsearch.snapshot.RestoreResponse$Builder.build(RestoreResponse.java:121)
at co.elastic.clients.elasticsearch.snapshot.RestoreResponse$Builder.build(RestoreResponse.java:94)
at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:80)
at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
at co.elastic.clients.transport.rest_client.RestClientTransport.decodeResponse(RestClientTransport.java:325)
at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:291)
at co.elastic.clients.transport.rest_client.RestClientTransport.performRequest(RestClientTransport.java:144)
at co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotClient.restore(ElasticsearchSnapshotClient.java:361)
at co.elastic.clients.elasticsearch.snapshot.ElasticsearchSnapshotClient.restore(ElasticsearchSnapshotClient.java:377)
```
The same problem also happens with `es/snapshot.restore`:
```java
co.elastic.clients.util.MissingRequiredPropertyException: Missing required property 'CreateSnapshotResponse.snapshot'
at co.elastic.clients.util.ApiTypeHelper.requireNonNull(ApiTypeHelper.java:76)
at co.elastic.clients.elasticsearch.snapshot.CreateSnapshotResponse.(CreateSnapshotResponse.java:61)
at co.elastic.clients.elasticsearch.snapshot.CreateSnapshotResponse.(CreateSnapshotResponse.java:50)
```
### Notes
From what I understand, the server responds with `{"acknowledged":true}` but in the spec the "snapshot" is mandatory.
https://github.com/elastic/elasticsearch-specification/blob/d19af7a3ccd53459593246fbc2fffe0c33d86712/specification/snapshot/restore/SnapshotRestoreResponse.ts#L24
See similar PR: https://github.com/elastic/elasticsearch-specification/pull/1326/files
Contributor guide
Assessment
This issue has not been assessed yet.