Skip to content

Commit 9775f01

Browse files
authored
Throttling info in DeleteByQueryResponse is optional (#600)
1 parent 5198f14 commit 9775f01

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

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

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ public class DeleteByQueryResponse implements JsonpSerializable {
8383
@Nullable
8484
private final Time throttled;
8585

86-
private final long throttledMillis;
86+
@Nullable
87+
private final Long throttledMillis;
8788

8889
@Nullable
8990
private final Time throttledUntil;
9091

91-
private final long throttledUntilMillis;
92+
@Nullable
93+
private final Long throttledUntilMillis;
9294

9395
@Nullable
9496
private final Boolean timedOut;
@@ -115,10 +117,9 @@ private DeleteByQueryResponse(Builder builder) {
115117
this.sliceId = builder.sliceId;
116118
this.task = builder.task;
117119
this.throttled = builder.throttled;
118-
this.throttledMillis = ApiTypeHelper.requireNonNull(builder.throttledMillis, this, "throttledMillis");
120+
this.throttledMillis = builder.throttledMillis;
119121
this.throttledUntil = builder.throttledUntil;
120-
this.throttledUntilMillis = ApiTypeHelper.requireNonNull(builder.throttledUntilMillis, this,
121-
"throttledUntilMillis");
122+
this.throttledUntilMillis = builder.throttledUntilMillis;
122123
this.timedOut = builder.timedOut;
123124
this.took = builder.took;
124125
this.total = builder.total;
@@ -202,9 +203,10 @@ public final Time throttled() {
202203
}
203204

204205
/**
205-
* Required - API name: {@code throttled_millis}
206+
* API name: {@code throttled_millis}
206207
*/
207-
public final long throttledMillis() {
208+
@Nullable
209+
public final Long throttledMillis() {
208210
return this.throttledMillis;
209211
}
210212

@@ -217,9 +219,10 @@ public final Time throttledUntil() {
217219
}
218220

219221
/**
220-
* Required - API name: {@code throttled_until_millis}
222+
* API name: {@code throttled_until_millis}
221223
*/
222-
public final long throttledUntilMillis() {
224+
@Nullable
225+
public final Long throttledUntilMillis() {
223226
return this.throttledUntilMillis;
224227
}
225228

@@ -316,17 +319,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
316319
this.throttled.serialize(generator, mapper);
317320

318321
}
319-
generator.writeKey("throttled_millis");
320-
generator.write(this.throttledMillis);
322+
if (this.throttledMillis != null) {
323+
generator.writeKey("throttled_millis");
324+
generator.write(this.throttledMillis);
321325

326+
}
322327
if (this.throttledUntil != null) {
323328
generator.writeKey("throttled_until");
324329
this.throttledUntil.serialize(generator, mapper);
325330

326331
}
327-
generator.writeKey("throttled_until_millis");
328-
generator.write(this.throttledUntilMillis);
332+
if (this.throttledUntilMillis != null) {
333+
generator.writeKey("throttled_until_millis");
334+
generator.write(this.throttledUntilMillis);
329335

336+
}
330337
if (this.timedOut != null) {
331338
generator.writeKey("timed_out");
332339
generator.write(this.timedOut);
@@ -391,11 +398,13 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
391398
@Nullable
392399
private Time throttled;
393400

401+
@Nullable
394402
private Long throttledMillis;
395403

396404
@Nullable
397405
private Time throttledUntil;
398406

407+
@Nullable
399408
private Long throttledUntilMillis;
400409

401410
@Nullable
@@ -519,9 +528,9 @@ public final Builder throttled(Function<Time.Builder, ObjectBuilder<Time>> fn) {
519528
}
520529

521530
/**
522-
* Required - API name: {@code throttled_millis}
531+
* API name: {@code throttled_millis}
523532
*/
524-
public final Builder throttledMillis(long value) {
533+
public final Builder throttledMillis(@Nullable Long value) {
525534
this.throttledMillis = value;
526535
return this;
527536
}
@@ -542,9 +551,9 @@ public final Builder throttledUntil(Function<Time.Builder, ObjectBuilder<Time>>
542551
}
543552

544553
/**
545-
* Required - API name: {@code throttled_until_millis}
554+
* API name: {@code throttled_until_millis}
546555
*/
547-
public final Builder throttledUntilMillis(long value) {
556+
public final Builder throttledUntilMillis(@Nullable Long value) {
548557
this.throttledUntilMillis = value;
549558
return this;
550559
}

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,10 +2609,10 @@
26092609
if (hash.length > 1) {
26102610
hash = hash.substring(1);
26112611
}
2612-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/0a58ae2e52dd1bc6227f65da9cbbcea5b61dde96/specification/" + (paths[hash] || "");
2612+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/9139309163228dcff9f68065d48b638af4124ce5/specification/" + (paths[hash] || "");
26132613
</script>
26142614
</head>
26152615
<body>
2616-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/0a58ae2e52dd1bc6227f65da9cbbcea5b61dde96/specification/">Elasticsearch API specification</a>.
2616+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/9139309163228dcff9f68065d48b638af4124ce5/specification/">Elasticsearch API specification</a>.
26172617
</body>
26182618
</html>

0 commit comments

Comments
 (0)