From fb4b849889417be669697d5d6dbb3fdf8985d840 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Sun, 4 Jan 2026 21:04:24 -0500 Subject: [PATCH] Re-generate client code using latest OpenSearch API specification (2026-01-05) (#1850) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../client/opensearch/_types/VersionType.java | 5 -- .../client/opensearch/core/search/Hit.java | 51 +++++++---------- .../opensearch/core/search/SearchResult.java | 55 ------------------- java-codegen/opensearch-openapi.yaml | 22 +++++--- 4 files changed, 32 insertions(+), 101 deletions(-) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/VersionType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/VersionType.java index 94c5d8a1a1..bff0b2fc68 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/VersionType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/VersionType.java @@ -55,11 +55,6 @@ public enum VersionType implements JsonEnum { */ ExternalGte("external_gte"), - /** - * The version number is forced to be the given value. - */ - Force("force"), - /** * The version number is managed internally by OpenSearch. */ diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Hit.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Hit.java index eb96d6b596..9914352a3b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Hit.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/Hit.java @@ -90,8 +90,8 @@ public class Hit implements PlainJsonSerializable, ToCopyableBuilder< @Nonnull private final Map innerHits; - @Nonnull - private final List matchedQueries; + @Nullable + private final JsonData matchedQueries; @Nonnull private final Map metaFields; @@ -140,7 +140,7 @@ private Hit(Builder builder) { this.ignoredFieldValues = ApiTypeHelper.unmodifiable(builder.ignoredFieldValues); this.index = builder.index; this.innerHits = ApiTypeHelper.unmodifiable(builder.innerHits); - this.matchedQueries = ApiTypeHelper.unmodifiable(builder.matchedQueries); + this.matchedQueries = builder.matchedQueries; this.metaFields = ApiTypeHelper.unmodifiable(builder.metaFields); this.nested = builder.nested; this.node = builder.node; @@ -224,10 +224,14 @@ public final Map innerHits() { } /** + * The names of queries that matched the document. When include_named_queries_score is false (default), returns an array of + * query names. When true, returns an object mapping query names to their scores. + *

* API name: {@code matched_queries} + *

*/ - @Nonnull - public final List matchedQueries() { + @Nullable + public final JsonData matchedQueries() { return this.matchedQueries; } @@ -418,13 +422,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (ApiTypeHelper.isDefined(this.matchedQueries)) { + if (this.matchedQueries != null) { generator.writeKey("matched_queries"); - generator.writeStartArray(); - for (String item0 : this.matchedQueries) { - generator.write(item0); - } - generator.writeEnd(); + this.matchedQueries.serialize(generator, mapper); } if (this.nested != null) { @@ -516,7 +516,7 @@ public static class Builder extends ObjectBuilderBase implements Copy @Nullable private Map innerHits; @Nullable - private List matchedQueries; + private JsonData matchedQueries; @Nullable private Map metaFields; @Nullable @@ -553,7 +553,7 @@ private Builder(Hit o) { this.ignoredFieldValues = _mapCopy(o.ignoredFieldValues); this.index = o.index; this.innerHits = _mapCopy(o.innerHits); - this.matchedQueries = _listCopy(o.matchedQueries); + this.matchedQueries = o.matchedQueries; this.metaFields = _mapCopy(o.metaFields); this.nested = o.nested; this.node = o.node; @@ -577,7 +577,7 @@ private Builder(Builder o) { this.ignoredFieldValues = _mapCopy(o.ignoredFieldValues); this.index = o.index; this.innerHits = _mapCopy(o.innerHits); - this.matchedQueries = _listCopy(o.matchedQueries); + this.matchedQueries = o.matchedQueries; this.metaFields = _mapCopy(o.metaFields); this.nested = o.nested; this.node = o.node; @@ -776,28 +776,15 @@ public final Builder innerHits(String key, Functioninclude_named_queries_score is false (default), returns an + * array of query names. When true, returns an object mapping query names to their scores. *

- * Adds all elements of list to matchedQueries. - *

- */ - @Nonnull - public final Builder matchedQueries(List list) { - this.matchedQueries = _listAddAll(this.matchedQueries, list); - return this; - } - - /** * API name: {@code matched_queries} - * - *

- * Adds one or more values to matchedQueries. *

*/ @Nonnull - public final Builder matchedQueries(String value, String... values) { - this.matchedQueries = _listAdd(this.matchedQueries, value, values); + public final Builder matchedQueries(@Nullable JsonData value) { + this.matchedQueries = value; return this; } @@ -1009,7 +996,7 @@ protected static void setupHitDeserializer( ); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "_index"); op.add(Builder::innerHits, JsonpDeserializer.stringMapDeserializer(InnerHitsResult._DESERIALIZER), "inner_hits"); - op.add(Builder::matchedQueries, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "matched_queries"); + op.add(Builder::matchedQueries, JsonData._DESERIALIZER, "matched_queries"); op.add(Builder::nested, NestedIdentity._DESERIALIZER, "_nested"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "_node"); op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SearchResult.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SearchResult.java index 1132c6713d..8617843201 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SearchResult.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/search/SearchResult.java @@ -69,9 +69,6 @@ public abstract class SearchResult implements PlainJsonSerializable { @Nullable private final ClusterStatistics clusters; - @Nonnull - private final Map fields; - @Nonnull private final HitsMetadata hits; @@ -111,7 +108,6 @@ public abstract class SearchResult implements PlainJsonSerializable { protected SearchResult(AbstractBuilder builder) { this.aggregations = ApiTypeHelper.unmodifiable(builder.aggregations); this.clusters = builder.clusters; - this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.hits = ApiTypeHelper.requireNonNull(builder.hits, this, "hits"); this.numReducePhases = builder.numReducePhases; this.phaseTook = builder.phaseTook; @@ -142,14 +138,6 @@ public final ClusterStatistics clusters() { return this.clusters; } - /** - * API name: {@code fields} - */ - @Nonnull - public final Map fields() { - return this.fields; - } - /** * Required - API name: {@code hits} */ @@ -265,16 +253,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.clusters.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } - generator.writeEnd(); - } - generator.writeKey("hits"); this.hits.serialize(generator, mapper); @@ -340,8 +318,6 @@ public abstract static class AbstractBuilder aggregations; @Nullable private ClusterStatistics clusters; - @Nullable - private Map fields; private HitsMetadata hits; @Nullable private Integer numReducePhases; @@ -368,7 +344,6 @@ protected AbstractBuilder() {} protected AbstractBuilder(SearchResult o) { this.aggregations = _mapCopy(o.aggregations); this.clusters = o.clusters; - this.fields = _mapCopy(o.fields); this.hits = o.hits; this.numReducePhases = o.numReducePhases; this.phaseTook = o.phaseTook; @@ -386,7 +361,6 @@ protected AbstractBuilder(SearchResult o) { protected AbstractBuilder(AbstractBuilder o) { this.aggregations = _mapCopy(o.aggregations); this.clusters = o.clusters; - this.fields = _mapCopy(o.fields); this.hits = o.hits; this.numReducePhases = o.numReducePhases; this.phaseTook = o.phaseTook; @@ -459,32 +433,6 @@ public final BuilderT clusters(Function - * Adds all elements of map to fields. - *

- */ - @Nonnull - public final BuilderT fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return self(); - } - - /** - * API name: {@code fields} - * - *

- * Adds an entry to fields. - *

- */ - @Nonnull - public final BuilderT fields(String key, JsonData value) { - this.fields = _mapPut(this.fields, key, value); - return self(); - } - /** * Required - API name: {@code hits} */ @@ -680,7 +628,6 @@ protected static other = (SearchResult) o; return Objects.equals(this.aggregations, other.aggregations) && Objects.equals(this.clusters, other.clusters) - && Objects.equals(this.fields, other.fields) && this.hits.equals(other.hits) && Objects.equals(this.numReducePhases, other.numReducePhases) && Objects.equals(this.phaseTook, other.phaseTook) diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index a1f510b250..efed1fcfff 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -40590,9 +40590,6 @@ components: - type: string const: external_gte description: The version number must be greater than or equal to the current version. - - type: string - const: force - description: The version number is forced to be the given value. - type: string const: internal description: The version number is managed internally by OpenSearch. @@ -51178,9 +51175,19 @@ components: additionalProperties: $ref: '#/components/schemas/_core.search___InnerHitsResult' matched_queries: - type: array - items: - type: string + description: The names of queries that matched the document. When `include_named_queries_score` is false (default), returns an array of query names. When true, returns an object mapping query names to their scores. + oneOf: + - title: names + description: An array of matched query names (default behavior when `include_named_queries_score` is false). + type: array + items: + type: string + - title: scores + description: A map of matched query names to their scores (when `include_named_queries_score` is true). + type: object + additionalProperties: + type: number + format: double _nested: $ref: '#/components/schemas/_core.search___NestedIdentity' _ignored: @@ -51659,9 +51666,6 @@ components: $ref: '#/components/schemas/_common.aggregations___Aggregate' _clusters: $ref: '#/components/schemas/_common___ClusterStatistics' - fields: - type: object - additionalProperties: true num_reduce_phases: type: integer format: int32