Skip to content

Commit 36f27a2

Browse files
committed
[codegen] update to latest api spec
1 parent 279fae0 commit 36f27a2

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,12 +1074,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
10741074
}
10751075
if (ApiTypeHelper.isDefined(this.storedFields)) {
10761076
generator.writeKey("stored_fields");
1077-
generator.writeStartArray();
1078-
for (String item0 : this.storedFields) {
1079-
generator.write(item0);
1077+
if (this.storedFields.size() == 1) {
1078+
String singleItem = this.storedFields.get(0);
1079+
generator.write(singleItem);
1080+
1081+
} else {
1082+
generator.writeStartArray();
1083+
for (String item0 : this.storedFields) {
1084+
generator.write(item0);
10801085

1086+
}
1087+
generator.writeEnd();
10811088
}
1082-
generator.writeEnd();
10831089

10841090
}
10851091
if (this.suggest != null) {

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
10601060
}
10611061
if (ApiTypeHelper.isDefined(this.storedFields)) {
10621062
generator.writeKey("stored_fields");
1063-
generator.writeStartArray();
1064-
for (String item0 : this.storedFields) {
1065-
generator.write(item0);
1063+
if (this.storedFields.size() == 1) {
1064+
String singleItem = this.storedFields.get(0);
1065+
generator.write(singleItem);
1066+
1067+
} else {
1068+
generator.writeStartArray();
1069+
for (String item0 : this.storedFields) {
1070+
generator.write(item0);
10661071

1072+
}
1073+
generator.writeEnd();
10671074
}
1068-
generator.writeEnd();
10691075

10701076
}
10711077
if (this.suggest != null) {

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
public class Hit<TDocument> implements JsonpSerializable {
7373
private final String index;
7474

75+
@Nullable
7576
private final String id;
7677

7778
@Nullable
@@ -127,7 +128,7 @@ public class Hit<TDocument> implements JsonpSerializable {
127128
private Hit(Builder<TDocument> builder) {
128129

129130
this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index");
130-
this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
131+
this.id = builder.id;
131132
this.score = builder.score;
132133
this.type = builder.type;
133134
this.explanation = builder.explanation;
@@ -161,8 +162,9 @@ public final String index() {
161162
}
162163

163164
/**
164-
* Required - API name: {@code _id}
165+
* API name: {@code _id}
165166
*/
167+
@Nullable
166168
public final String id() {
167169
return this.id;
168170
}
@@ -311,9 +313,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
311313
generator.writeKey("_index");
312314
generator.write(this.index);
313315

314-
generator.writeKey("_id");
315-
generator.write(this.id);
316+
if (this.id != null) {
317+
generator.writeKey("_id");
318+
generator.write(this.id);
316319

320+
}
317321
if (this.score != null) {
318322
generator.writeKey("_score");
319323
generator.write(this.score);
@@ -458,6 +462,7 @@ public static class Builder<TDocument> extends WithJsonObjectBuilderBase<Builder
458462
ObjectBuilder<Hit<TDocument>> {
459463
private String index;
460464

465+
@Nullable
461466
private String id;
462467

463468
@Nullable
@@ -523,9 +528,9 @@ public final Builder<TDocument> index(String value) {
523528
}
524529

525530
/**
526-
* Required - API name: {@code _id}
531+
* API name: {@code _id}
527532
*/
528-
public final Builder<TDocument> id(String value) {
533+
public final Builder<TDocument> id(@Nullable String value) {
529534
this.id = value;
530535
return this;
531536
}

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
@@ -2351,10 +2351,10 @@
23512351
if (hash.length > 1) {
23522352
hash = hash.substring(1);
23532353
}
2354-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/3458c5d2594e7ad33da1b128469faa09881bbead/specification/" + (paths[hash] || "");
2354+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/60128dd705a0e7c7f4da6044f1c54ff6a86157eb/specification/" + (paths[hash] || "");
23552355
</script>
23562356
</head>
23572357
<body>
2358-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/3458c5d2594e7ad33da1b128469faa09881bbead/specification/">Elasticsearch API specification</a>.
2358+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/60128dd705a0e7c7f4da6044f1c54ff6a86157eb/specification/">Elasticsearch API specification</a>.
23592359
</body>
23602360
</html>

0 commit comments

Comments
 (0)