Skip to content

Commit d2c8b4c

Browse files
committed
[codegen] update to latest spec
1 parent 7ac9263 commit d2c8b4c

File tree

12 files changed

+139
-158
lines changed

12 files changed

+139
-158
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ public ElasticsearchXpackAsyncClient xpack() {
462462
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
463463
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
464464
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
465+
* <li>Java: Check out
466+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
465467
* <li>.NET: Check out <code>BulkAllObservable</code></li>
466468
* <li>PHP: Check out bulk indexing.</li>
467469
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -637,6 +639,8 @@ public CompletableFuture<BulkResponse> bulk(BulkRequest request) {
637639
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
638640
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
639641
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
642+
* <li>Java: Check out
643+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
640644
* <li>.NET: Check out <code>BulkAllObservable</code></li>
641645
* <li>PHP: Check out bulk indexing.</li>
642646
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -812,6 +816,8 @@ public final CompletableFuture<BulkResponse> bulk(Function<BulkRequest.Builder,
812816
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
813817
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
814818
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
819+
* <li>Java: Check out
820+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
815821
* <li>.NET: Check out <code>BulkAllObservable</code></li>
816822
* <li>PHP: Check out bulk indexing.</li>
817823
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>

java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,8 @@ public ElasticsearchXpackClient xpack() {
463463
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
464464
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
465465
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
466+
* <li>Java: Check out
467+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
466468
* <li>.NET: Check out <code>BulkAllObservable</code></li>
467469
* <li>PHP: Check out bulk indexing.</li>
468470
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -638,6 +640,8 @@ public BulkResponse bulk(BulkRequest request) throws IOException, ElasticsearchE
638640
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
639641
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
640642
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
643+
* <li>Java: Check out
644+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
641645
* <li>.NET: Check out <code>BulkAllObservable</code></li>
642646
* <li>PHP: Check out bulk indexing.</li>
643647
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -814,6 +818,8 @@ public final BulkResponse bulk(Function<BulkRequest.Builder, ObjectBuilder<BulkR
814818
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
815819
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
816820
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
821+
* <li>Java: Check out
822+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
817823
* <li>.NET: Check out <code>BulkAllObservable</code></li>
818824
* <li>PHP: Check out bulk indexing.</li>
819825
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>

java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchResponseBase.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package co.elastic.clients.elasticsearch.async_search;
2121

22+
import co.elastic.clients.elasticsearch._types.ErrorCause;
2223
import co.elastic.clients.json.JsonpDeserializable;
2324
import co.elastic.clients.json.JsonpDeserializer;
2425
import co.elastic.clients.json.JsonpMapper;
@@ -35,6 +36,7 @@
3536
import java.lang.Long;
3637
import java.lang.String;
3738
import java.util.Objects;
39+
import java.util.function.Function;
3840
import javax.annotation.Nullable;
3941

4042
//----------------------------------------------------------------
@@ -85,6 +87,9 @@ public abstract class AsyncSearchResponseBase implements JsonpSerializable {
8587
@Nullable
8688
private final Long completionTimeInMillis;
8789

90+
@Nullable
91+
private final ErrorCause error;
92+
8893
// ---------------------------------------------------------------------------------------------
8994

9095
protected AsyncSearchResponseBase(AbstractBuilder<?> builder) {
@@ -99,6 +104,7 @@ protected AsyncSearchResponseBase(AbstractBuilder<?> builder) {
99104
this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis", 0);
100105
this.completionTime = builder.completionTime;
101106
this.completionTimeInMillis = builder.completionTimeInMillis;
107+
this.error = builder.error;
102108

103109
}
104110

@@ -189,6 +195,14 @@ public final Long completionTimeInMillis() {
189195
return this.completionTimeInMillis;
190196
}
191197

198+
/**
199+
* API name: {@code error}
200+
*/
201+
@Nullable
202+
public final ErrorCause error() {
203+
return this.error;
204+
}
205+
192206
/**
193207
* Serialize this object to JSON.
194208
*/
@@ -234,6 +248,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
234248
generator.write(this.completionTimeInMillis);
235249

236250
}
251+
if (this.error != null) {
252+
generator.writeKey("error");
253+
this.error.serialize(generator, mapper);
254+
255+
}
237256

238257
}
239258

@@ -268,6 +287,9 @@ public abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<Bu
268287
@Nullable
269288
private Long completionTimeInMillis;
270289

290+
@Nullable
291+
private ErrorCause error;
292+
271293
/**
272294
* API name: {@code id}
273295
*/
@@ -359,6 +381,21 @@ public final BuilderT completionTimeInMillis(@Nullable Long value) {
359381
return self();
360382
}
361383

384+
/**
385+
* API name: {@code error}
386+
*/
387+
public final BuilderT error(@Nullable ErrorCause value) {
388+
this.error = value;
389+
return self();
390+
}
391+
392+
/**
393+
* API name: {@code error}
394+
*/
395+
public final BuilderT error(Function<ErrorCause.Builder, ObjectBuilder<ErrorCause>> fn) {
396+
return this.error(fn.apply(new ErrorCause.Builder()).build());
397+
}
398+
362399
protected abstract BuilderT self();
363400

364401
}
@@ -378,6 +415,7 @@ protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupAsyncSea
378415
op.add(AbstractBuilder::completionTime, DateTime._DESERIALIZER, "completion_time");
379416
op.add(AbstractBuilder::completionTimeInMillis, JsonpDeserializer.longDeserializer(),
380417
"completion_time_in_millis");
418+
op.add(AbstractBuilder::error, ErrorCause._DESERIALIZER, "error");
381419

382420
}
383421

java-client/src/main/java/co/elastic/clients/elasticsearch/core/BulkRequest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@
168168
* <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
169169
* <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
170170
* <li>JavaScript: Check out <code>client.helpers.*</code></li>
171+
* <li>Java: Check out
172+
* <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
171173
* <li>.NET: Check out <code>BulkAllObservable</code></li>
172174
* <li>PHP: Check out bulk indexing.</li>
173175
* <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>

java-client/src/main/java/co/elastic/clients/elasticsearch/core/DeleteByQueryRethrottleRequest.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,15 @@
6969
*/
7070

7171
public class DeleteByQueryRethrottleRequest extends RequestBase {
72-
@Nullable
73-
private final Float requestsPerSecond;
72+
private final float requestsPerSecond;
7473

7574
private final String taskId;
7675

7776
// ---------------------------------------------------------------------------------------------
7877

7978
private DeleteByQueryRethrottleRequest(Builder builder) {
8079

81-
this.requestsPerSecond = builder.requestsPerSecond;
80+
this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond", 0);
8281
this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId");
8382

8483
}
@@ -89,13 +88,12 @@ public static DeleteByQueryRethrottleRequest of(
8988
}
9089

9190
/**
92-
* The throttle for this request in sub-requests per second. To disable
93-
* throttling, set it to <code>-1</code>.
91+
* Required - The throttle for this request in sub-requests per second. To
92+
* disable throttling, set it to <code>-1</code>.
9493
* <p>
9594
* API name: {@code requests_per_second}
9695
*/
97-
@Nullable
98-
public final Float requestsPerSecond() {
96+
public final float requestsPerSecond() {
9997
return this.requestsPerSecond;
10098
}
10199

@@ -117,18 +115,17 @@ public final String taskId() {
117115
public static class Builder extends RequestBase.AbstractBuilder<Builder>
118116
implements
119117
ObjectBuilder<DeleteByQueryRethrottleRequest> {
120-
@Nullable
121118
private Float requestsPerSecond;
122119

123120
private String taskId;
124121

125122
/**
126-
* The throttle for this request in sub-requests per second. To disable
127-
* throttling, set it to <code>-1</code>.
123+
* Required - The throttle for this request in sub-requests per second. To
124+
* disable throttling, set it to <code>-1</code>.
128125
* <p>
129126
* API name: {@code requests_per_second}
130127
*/
131-
public final Builder requestsPerSecond(@Nullable Float value) {
128+
public final Builder requestsPerSecond(float value) {
132129
this.requestsPerSecond = value;
133130
return this;
134131
}
@@ -213,9 +210,7 @@ public DeleteByQueryRethrottleRequest build() {
213210
// Request parameters
214211
request -> {
215212
Map<String, String> params = new HashMap<>();
216-
if (request.requestsPerSecond != null) {
217-
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
218-
}
213+
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
219214
return params;
220215

221216
}, SimpleEndpoint.emptyMap(), false, DeleteByQueryRethrottleResponse._DESERIALIZER);

java-client/src/main/java/co/elastic/clients/elasticsearch/core/ReindexRethrottleRequest.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,15 @@
7676
*/
7777

7878
public class ReindexRethrottleRequest extends RequestBase {
79-
@Nullable
80-
private final Float requestsPerSecond;
79+
private final float requestsPerSecond;
8180

8281
private final String taskId;
8382

8483
// ---------------------------------------------------------------------------------------------
8584

8685
private ReindexRethrottleRequest(Builder builder) {
8786

88-
this.requestsPerSecond = builder.requestsPerSecond;
87+
this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond", 0);
8988
this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId");
9089

9190
}
@@ -95,14 +94,13 @@ public static ReindexRethrottleRequest of(Function<Builder, ObjectBuilder<Reinde
9594
}
9695

9796
/**
98-
* The throttle for this request in sub-requests per second. It can be either
99-
* <code>-1</code> to turn off throttling or any decimal number like
97+
* Required - The throttle for this request in sub-requests per second. It can
98+
* be either <code>-1</code> to turn off throttling or any decimal number like
10099
* <code>1.7</code> or <code>12</code> to throttle to that level.
101100
* <p>
102101
* API name: {@code requests_per_second}
103102
*/
104-
@Nullable
105-
public final Float requestsPerSecond() {
103+
public final float requestsPerSecond() {
106104
return this.requestsPerSecond;
107105
}
108106

@@ -124,19 +122,18 @@ public final String taskId() {
124122
public static class Builder extends RequestBase.AbstractBuilder<Builder>
125123
implements
126124
ObjectBuilder<ReindexRethrottleRequest> {
127-
@Nullable
128125
private Float requestsPerSecond;
129126

130127
private String taskId;
131128

132129
/**
133-
* The throttle for this request in sub-requests per second. It can be either
134-
* <code>-1</code> to turn off throttling or any decimal number like
130+
* Required - The throttle for this request in sub-requests per second. It can
131+
* be either <code>-1</code> to turn off throttling or any decimal number like
135132
* <code>1.7</code> or <code>12</code> to throttle to that level.
136133
* <p>
137134
* API name: {@code requests_per_second}
138135
*/
139-
public final Builder requestsPerSecond(@Nullable Float value) {
136+
public final Builder requestsPerSecond(float value) {
140137
this.requestsPerSecond = value;
141138
return this;
142139
}
@@ -221,9 +218,7 @@ public ReindexRethrottleRequest build() {
221218
// Request parameters
222219
request -> {
223220
Map<String, String> params = new HashMap<>();
224-
if (request.requestsPerSecond != null) {
225-
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
226-
}
221+
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
227222
return params;
228223

229224
}, SimpleEndpoint.emptyMap(), false, ReindexRethrottleResponse._DESERIALIZER);

java-client/src/main/java/co/elastic/clients/elasticsearch/core/UpdateByQueryRethrottleRequest.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,15 @@
6969
*/
7070

7171
public class UpdateByQueryRethrottleRequest extends RequestBase {
72-
@Nullable
73-
private final Float requestsPerSecond;
72+
private final float requestsPerSecond;
7473

7574
private final String taskId;
7675

7776
// ---------------------------------------------------------------------------------------------
7877

7978
private UpdateByQueryRethrottleRequest(Builder builder) {
8079

81-
this.requestsPerSecond = builder.requestsPerSecond;
80+
this.requestsPerSecond = ApiTypeHelper.requireNonNull(builder.requestsPerSecond, this, "requestsPerSecond", 0);
8281
this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId");
8382

8483
}
@@ -89,13 +88,12 @@ public static UpdateByQueryRethrottleRequest of(
8988
}
9089

9190
/**
92-
* The throttle for this request in sub-requests per second. To turn off
93-
* throttling, set it to <code>-1</code>.
91+
* Required - The throttle for this request in sub-requests per second. To turn
92+
* off throttling, set it to <code>-1</code>.
9493
* <p>
9594
* API name: {@code requests_per_second}
9695
*/
97-
@Nullable
98-
public final Float requestsPerSecond() {
96+
public final float requestsPerSecond() {
9997
return this.requestsPerSecond;
10098
}
10199

@@ -117,18 +115,17 @@ public final String taskId() {
117115
public static class Builder extends RequestBase.AbstractBuilder<Builder>
118116
implements
119117
ObjectBuilder<UpdateByQueryRethrottleRequest> {
120-
@Nullable
121118
private Float requestsPerSecond;
122119

123120
private String taskId;
124121

125122
/**
126-
* The throttle for this request in sub-requests per second. To turn off
127-
* throttling, set it to <code>-1</code>.
123+
* Required - The throttle for this request in sub-requests per second. To turn
124+
* off throttling, set it to <code>-1</code>.
128125
* <p>
129126
* API name: {@code requests_per_second}
130127
*/
131-
public final Builder requestsPerSecond(@Nullable Float value) {
128+
public final Builder requestsPerSecond(float value) {
132129
this.requestsPerSecond = value;
133130
return this;
134131
}
@@ -213,9 +210,7 @@ public UpdateByQueryRethrottleRequest build() {
213210
// Request parameters
214211
request -> {
215212
Map<String, String> params = new HashMap<>();
216-
if (request.requestsPerSecond != null) {
217-
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
218-
}
213+
params.put("requests_per_second", String.valueOf(request.requestsPerSecond));
219214
return params;
220215

221216
}, SimpleEndpoint.emptyMap(), false, UpdateByQueryRethrottleResponse._DESERIALIZER);

0 commit comments

Comments
 (0)