Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ public class Hit<TDocument> implements PlainJsonSerializable, ToCopyableBuilder<
@Nonnull
private final Map<String, InnerHitsResult> innerHits;

@Nonnull
private final List<String> matchedQueries;
@Nullable
private final JsonData matchedQueries;

@Nonnull
private final Map<String, JsonData> metaFields;
Expand Down Expand Up @@ -140,7 +140,7 @@ private Hit(Builder<TDocument> 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;
Expand Down Expand Up @@ -224,10 +224,14 @@ public final Map<String, InnerHitsResult> innerHits() {
}

/**
* The names of queries that matched the document. When <code>include_named_queries_score</code> is false (default), returns an array of
* query names. When true, returns an object mapping query names to their scores.
* <p>
* API name: {@code matched_queries}
* </p>
*/
@Nonnull
public final List<String> matchedQueries() {
@Nullable
public final JsonData matchedQueries() {
return this.matchedQueries;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -516,7 +516,7 @@ public static class Builder<TDocument> extends ObjectBuilderBase implements Copy
@Nullable
private Map<String, InnerHitsResult> innerHits;
@Nullable
private List<String> matchedQueries;
private JsonData matchedQueries;
@Nullable
private Map<String, JsonData> metaFields;
@Nullable
Expand Down Expand Up @@ -553,7 +553,7 @@ private Builder(Hit<TDocument> 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;
Expand All @@ -577,7 +577,7 @@ private Builder(Builder<TDocument> 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;
Expand Down Expand Up @@ -776,28 +776,15 @@ public final Builder<TDocument> innerHits(String key, Function<InnerHitsResult.B
}

/**
* API name: {@code matched_queries}
*
* The names of queries that matched the document. When <code>include_named_queries_score</code> is false (default), returns an
* array of query names. When true, returns an object mapping query names to their scores.
* <p>
* Adds all elements of <code>list</code> to <code>matchedQueries</code>.
* </p>
*/
@Nonnull
public final Builder<TDocument> matchedQueries(List<String> list) {
this.matchedQueries = _listAddAll(this.matchedQueries, list);
return this;
}

/**
* API name: {@code matched_queries}
*
* <p>
* Adds one or more values to <code>matchedQueries</code>.
* </p>
*/
@Nonnull
public final Builder<TDocument> matchedQueries(String value, String... values) {
this.matchedQueries = _listAdd(this.matchedQueries, value, values);
public final Builder<TDocument> matchedQueries(@Nullable JsonData value) {
this.matchedQueries = value;
return this;
}

Expand Down Expand Up @@ -1009,7 +996,7 @@ protected static <TDocument> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ public abstract class SearchResult<TDocument> implements PlainJsonSerializable {
@Nullable
private final ClusterStatistics clusters;

@Nonnull
private final Map<String, JsonData> fields;

@Nonnull
private final HitsMetadata<TDocument> hits;

Expand Down Expand Up @@ -111,7 +108,6 @@ public abstract class SearchResult<TDocument> implements PlainJsonSerializable {
protected SearchResult(AbstractBuilder<TDocument, ?> 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;
Expand Down Expand Up @@ -142,14 +138,6 @@ public final ClusterStatistics clusters() {
return this.clusters;
}

/**
* API name: {@code fields}
*/
@Nonnull
public final Map<String, JsonData> fields() {
return this.fields;
}

/**
* Required - API name: {@code hits}
*/
Expand Down Expand Up @@ -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<String, JsonData> item0 : this.fields.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);
}
generator.writeEnd();
}

generator.writeKey("hits");
this.hits.serialize(generator, mapper);

Expand Down Expand Up @@ -340,8 +318,6 @@ public abstract static class AbstractBuilder<TDocument, BuilderT extends Abstrac
private Map<String, Aggregate> aggregations;
@Nullable
private ClusterStatistics clusters;
@Nullable
private Map<String, JsonData> fields;
private HitsMetadata<TDocument> hits;
@Nullable
private Integer numReducePhases;
Expand All @@ -368,7 +344,6 @@ protected AbstractBuilder() {}
protected AbstractBuilder(SearchResult<TDocument> 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;
Expand All @@ -386,7 +361,6 @@ protected AbstractBuilder(SearchResult<TDocument> o) {
protected AbstractBuilder(AbstractBuilder<TDocument, BuilderT> 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;
Expand Down Expand Up @@ -459,32 +433,6 @@ public final BuilderT clusters(Function<ClusterStatistics.Builder, ObjectBuilder
return clusters(fn.apply(new ClusterStatistics.Builder()).build());
}

/**
* API name: {@code fields}
*
* <p>
* Adds all elements of <code>map</code> to <code>fields</code>.
* </p>
*/
@Nonnull
public final BuilderT fields(Map<String, JsonData> map) {
this.fields = _mapPutAll(this.fields, map);
return self();
}

/**
* API name: {@code fields}
*
* <p>
* Adds an entry to <code>fields</code>.
* </p>
*/
@Nonnull
public final BuilderT fields(String key, JsonData value) {
this.fields = _mapPut(this.fields, key, value);
return self();
}

/**
* Required - API name: {@code hits}
*/
Expand Down Expand Up @@ -680,7 +628,6 @@ protected static <TDocument, BuilderT extends AbstractBuilder<TDocument, Builder
) {
op.add(AbstractBuilder::aggregations, Aggregate._TYPED_KEYS_DESERIALIZER, "aggregations");
op.add(AbstractBuilder::clusters, ClusterStatistics._DESERIALIZER, "_clusters");
op.add(AbstractBuilder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields");
op.add(AbstractBuilder::hits, HitsMetadata.createHitsMetadataDeserializer(tDocumentDeserializer), "hits");
op.add(AbstractBuilder::numReducePhases, JsonpDeserializer.integerDeserializer(), "num_reduce_phases");
op.add(AbstractBuilder::phaseTook, PhaseTook._DESERIALIZER, "phase_took");
Expand Down Expand Up @@ -708,7 +655,6 @@ public int hashCode() {
int result = 17;
result = 31 * result + Objects.hashCode(this.aggregations);
result = 31 * result + Objects.hashCode(this.clusters);
result = 31 * result + Objects.hashCode(this.fields);
result = 31 * result + this.hits.hashCode();
result = 31 * result + Objects.hashCode(this.numReducePhases);
result = 31 * result + Objects.hashCode(this.phaseTook);
Expand All @@ -731,7 +677,6 @@ public boolean equals(Object o) {
SearchResult<?> 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)
Expand Down
22 changes: 13 additions & 9 deletions java-codegen/opensearch-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading