diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7fd5e31b..7a8be39b1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added support for icu_collation_keyword type ([#725](https://github.com/opensearch-project/opensearch-java/pull/725)) - Added support for flat_object field property ([#735](https://github.com/opensearch-project/opensearch-java/pull/735)) - Expose HTTP status code through `ResponseException#status` ([#756](https://github.com/opensearch-project/opensearch-java/pull/756)) +- Added toBuilder method to all request model in core package & _types.query_dsl package ([#766](https://github.com/opensearch-project/opensearch-java/pull/766)) ### Dependencies - Bumps `com.diffplug.spotless` from 6.22.0 to 6.23.3 diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java index d99810d495..d8d4a6f915 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQuery.java @@ -171,6 +171,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().filter(filter).minimumShouldMatch(minimumShouldMatch).must(must).mustNot(mustNot).should(should); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java index aba9ae8b22..4aa7ed3a2a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/BoostingQuery.java @@ -110,6 +110,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().negativeBoost(negativeBoost).negative(negative).positive(positive); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java index 24d58587a6..35c8571c36 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQuery.java @@ -173,6 +173,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().fields(fields) + .query(query) + .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) + .operator(operator) + .mimimumShouldMatch(mimimumShouldMatch) + .zeroTermsQuery(zeroTermsQuery); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java index 98dccc2b33..e0bd23f71d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQuery.java @@ -182,6 +182,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .analyzer(analyzer) + .cutoffFrequency(cutoffFrequency) + .highFreqOperator(highFreqOperator) + .lowFreqOperator(lowFreqOperator) + .minimumShouldMatch(minimumShouldMatch) + .query(query); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java index aa5a104b32..a958275eb5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ConstantScoreQuery.java @@ -84,6 +84,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().filter(filter); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunction.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunction.java index 5233e1a035..22f3a85578 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunction.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunction.java @@ -93,6 +93,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).placement(placement); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacement.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacement.java index aedd520c8e..78caeecbc4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacement.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacement.java @@ -142,6 +142,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().decay(decay).offset(offset).scale(scale).origin(origin); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java index b10fca96da..f03de385e9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQuery.java @@ -111,6 +111,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().queries(queries).tieBreaker(tieBreaker); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java index f63fc7008f..781c750ebf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQuery.java @@ -111,6 +111,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().origin(origin).pivot(pivot).field(field); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java index ce288566c3..1a5b8f0e8c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQuery.java @@ -84,6 +84,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormat.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormat.java index c8a4e32afe..bbfb8629c4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormat.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormat.java @@ -131,6 +131,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).format(format).includeUnmapped(includeUnmapped); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookup.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookup.java index d8ab381cc7..6f43462366 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookup.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookup.java @@ -138,6 +138,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().id(id).index(index).path(path).routing(routing); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunction.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunction.java index c2fe192096..b6b78e3e61 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunction.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunction.java @@ -136,6 +136,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).factor(factor).missing(missing).modifier(modifier); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScore.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScore.java index 5874ca2a81..7b77683800 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScore.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScore.java @@ -275,6 +275,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value).filter(filter).weight(weight); + } + public static class Builder extends ObjectBuilderBase { private Kind _kind; private Object _value; @@ -285,6 +289,16 @@ public static class Builder extends ObjectBuilderBase { @Nullable private Double weight; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + /** * API name: {@code filter} */ diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java index 415fb9bec1..34124bbaa8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQuery.java @@ -177,6 +177,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().boostMode(boostMode) + .functions(functions) + .maxBoost(maxBoost) + .minScore(minScore) + .query(query) + .scoreMode(scoreMode); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java index 58c5777a38..91fc3b1a66 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQuery.java @@ -185,6 +185,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .value(value) + .maxExpansions(maxExpansions) + .prefixLength(prefixLength) + .rewrite(rewrite) + .transpositions(transpositions) + .fuzziness(fuzziness) + .value(value); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java index 6fda8cc768..272ab31a7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQuery.java @@ -148,6 +148,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .boundingBox(boundingBox) + .type(type) + .validationMethod(validationMethod) + .ignoreUnmapped(ignoreUnmapped); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java index 440d0b5697..31b14157bb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQuery.java @@ -146,6 +146,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).location(location); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPoints.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPoints.java index 83303760bd..b476e7763b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPoints.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPoints.java @@ -95,6 +95,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().points(points); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQuery.java index 35d1d37053..9e984b42b0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQuery.java @@ -125,6 +125,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().shape(shape).indexedShape(indexedShape).relation(relation); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java index b8d024d018..0047aaac67 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeQuery.java @@ -112,6 +112,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).shape(shape); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java index aade331876..2e2cdd1cf1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQuery.java @@ -183,6 +183,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().ignoreUnmapped(ignoreUnmapped) + .innerHits(innerHits) + .maxChildren(maxChildren) + .minChildren(minChildren) + .query(query) + .scoreMode(scoreMode) + .type(type); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java index cd00095534..4019246161 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQuery.java @@ -151,6 +151,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().ignoreUnmapped(ignoreUnmapped).innerHits(innerHits).parentType(parentType).query(query).score(score); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java index 49945073b4..687158d529 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQuery.java @@ -94,6 +94,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().values(values); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Intervals.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Intervals.java index 84f4afe841..94058d9caa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Intervals.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Intervals.java @@ -242,10 +242,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder allOf(IntervalsAllOf v) { this._kind = Kind.AllOf; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOf.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOf.java index 2f6689caab..d66d483399 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOf.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOf.java @@ -162,6 +162,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().intervals(intervals).maxGaps(maxGaps).ordered(ordered).filter(filter); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOf.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOf.java index 07033d268d..374427f55f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOf.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOf.java @@ -128,6 +128,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().intervals(intervals); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilter.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilter.java index d0594b822f..8667451878 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilter.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilter.java @@ -294,10 +294,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder after(Intervals v) { this._kind = Kind.After; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzy.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzy.java index 82c155a5a6..6c953e9fe8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzy.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzy.java @@ -188,6 +188,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer) + .fuzziness(fuzziness) + .prefixLength(prefixLength) + .term(term) + .transpositions(transpositions) + .useField(useField); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatch.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatch.java index c4da1a6b68..77da848e9f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatch.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatch.java @@ -188,6 +188,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer).maxGaps(maxGaps).ordered(ordered).query(query).useField(useField).filter(filter); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefix.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefix.java index eba3c81be4..54467eda04 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefix.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefix.java @@ -137,6 +137,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer).prefix(prefix).useField(useField); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java index 2b241325c7..d5c655db15 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQuery.java @@ -251,6 +251,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value).field(field); + } + public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { private Kind _kind; private Object _value; @@ -270,6 +274,16 @@ protected Builder self() { return this; } + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder allOf(IntervalsAllOf v) { this._kind = Kind.AllOf; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcard.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcard.java index 23eb571b37..7d66e9565d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcard.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcard.java @@ -137,6 +137,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer).pattern(pattern).useField(useField); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java index 025e764f0d..175fe6e11a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQuery.java @@ -107,6 +107,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + public Builder toBuilder() { + return new Builder().field(field).vector(vector).k(k).filter(filter); + } + /** * Builder for {@link KnnQuery}. */ diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Like.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Like.java index 685cc56c75..ca4d78bc50 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Like.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Like.java @@ -139,10 +139,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder document(LikeDocument v) { this._kind = Kind.Document; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocument.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocument.java index 26bd3f2621..520847812b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocument.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocument.java @@ -237,6 +237,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().doc(doc) + .fields(fields) + .id(id) + .type(type) + .index(index) + .perFieldAnalyzer(perFieldAnalyzer) + .routing(routing) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java index 56ff2e0264..b370342728 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQuery.java @@ -234,6 +234,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .analyzer(analyzer) + .fuzziness(fuzziness) + .fuzzyRewrite(fuzzyRewrite) + .fuzzyTranspositions(fuzzyTranspositions) + .maxExpansions(maxExpansions) + .minimumShouldMatch(minimumShouldMatch) + .operator(operator) + .prefixLength(prefixLength) + .query(query); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java index b46d9f09d3..bba0cf42f7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQuery.java @@ -167,6 +167,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .analyzer(analyzer) + .maxExpansions(maxExpansions) + .query(query) + .slop(slop) + .zeroTermsQuery(zeroTermsQuery); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java index dab890c26a..2e7ac94bec 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQuery.java @@ -150,6 +150,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).analyzer(analyzer).query(query).slop(slop).zeroTermsQuery(zeroTermsQuery); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java index 2379d2f25d..cab702a5b2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQuery.java @@ -306,6 +306,23 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .analyzer(analyzer) + .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) + .cutoffFrequency(cutoffFrequency) + .fuzziness(fuzziness) + .fuzzyRewrite(fuzzyRewrite) + .fuzzyTranspositions(fuzzyTranspositions) + .lenient(lenient) + .maxExpansions(maxExpansions) + .minimumShouldMatch(minimumShouldMatch) + .operator(operator) + .prefixLength(prefixLength) + .query(query) + .zeroTermsQuery(zeroTermsQuery); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java index 9bc0a945b5..f75d0dce97 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQuery.java @@ -414,6 +414,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer) + .boostTerms(boostTerms) + .failOnUnsupportedField(failOnUnsupportedField) + .fields(fields) + .include(include) + .like(like) + .maxDocFreq(maxDocFreq) + .maxQueryTerms(maxQueryTerms) + .maxWordLength(maxWordLength) + .minDocFreq(minDocFreq) + .minimumShouldMatch(minimumShouldMatch) + .minTermFreq(minTermFreq) + .minWordLength(minWordLength) + .perFieldAnalyzer(perFieldAnalyzer) + .routing(routing) + .stopWords(stopWords) + .unlike(unlike) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java index ff2b6b76b0..192fbc5b70 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQuery.java @@ -362,6 +362,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer) + .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) + .cutoffFrequency(cutoffFrequency) + .fields(fields) + .fuzziness(fuzziness) + .fuzzyRewrite(fuzzyRewrite) + .fuzzyTranspositions(fuzzyTranspositions) + .lenient(lenient) + .maxExpansions(maxExpansions) + .minimumShouldMatch(minimumShouldMatch) + .operator(operator) + .prefixLength(prefixLength) + .query(query) + .slop(slop) + .tieBreaker(tieBreaker) + .type(type) + .zeroTermsQuery(zeroTermsQuery); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java index ce3f8cf3d0..997d553728 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQuery.java @@ -150,6 +150,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().ignoreUnmapped(ignoreUnmapped).innerHits(innerHits).path(path).query(query).scoreMode(scoreMode); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java index 083200fe81..4e2520d199 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQuery.java @@ -110,6 +110,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + public Builder toBuilder() { + return new Builder().field(field).queryText(queryText).k(k).modelId(modelId); + } + /** * Builder for {@link NeuralQuery}. */ diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java index 198932a774..62d0212560 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQuery.java @@ -123,6 +123,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().id(id).ignoreUnmapped(ignoreUnmapped).type(type); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java index 10098952f6..947b08889a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQuery.java @@ -227,6 +227,18 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().document(document) + .documents(documents) + .field(field) + .id(id) + .index(index) + .name(name) + .preference(preference) + .routing(routing) + .version(version); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDoc.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDoc.java index 4fb7e7b956..39f8f35902 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDoc.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDoc.java @@ -98,6 +98,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().id(id).index(index); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java index 7c1d29ec7f..eabd1d8222 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQuery.java @@ -196,6 +196,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value).organic(organic); + } + public static class Builder extends QueryBase.AbstractBuilder { private Kind _kind; private Object _value; @@ -222,6 +226,16 @@ protected Builder self() { return this; } + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ContainerBuilder ids(List v) { this._kind = Kind.Ids; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java index f34545c757..b64fbd5328 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQuery.java @@ -134,6 +134,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).value(value).rewrite(rewrite).value(value).caseInsensitive(caseInsensitive); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java index 7413df3593..0890341a86 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/Query.java @@ -1185,10 +1185,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder bool(BoolQuery v) { this._kind = Kind.Bool; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java index c152ba0baa..d1c074b648 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQuery.java @@ -496,6 +496,34 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowLeadingWildcard(allowLeadingWildcard) + .analyzer(analyzer) + .analyzeWildcard(analyzeWildcard) + .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) + .defaultField(defaultField) + .defaultOperator(defaultOperator) + .enablePositionIncrements(enablePositionIncrements) + .escape(escape) + .fields(fields) + .fuzziness(fuzziness) + .fuzzyMaxExpansions(fuzzyMaxExpansions) + .fuzzyPrefixLength(fuzzyPrefixLength) + .fuzzyRewrite(fuzzyRewrite) + .fuzzyTranspositions(fuzzyTranspositions) + .lenient(lenient) + .maxDeterminizedStates(maxDeterminizedStates) + .minimumShouldMatch(minimumShouldMatch) + .phraseSlop(phraseSlop) + .query(query) + .quoteAnalyzer(quoteAnalyzer) + .quoteFieldSuffix(quoteFieldSuffix) + .rewrite(rewrite) + .tieBreaker(tieBreaker) + .timeZone(timeZone) + .type(type); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunction.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunction.java index b61a9d6d5d..98f052a58a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunction.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunction.java @@ -106,6 +106,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).seed(seed); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java index 7116f6e480..60e85dc4c3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQuery.java @@ -224,6 +224,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).gt(gt).gte(gte).lt(lt).lte(lte).from(from).to(to).format(format).timeZone(timeZone); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithm.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithm.java index d53591f854..5ca1477eb7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithm.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithm.java @@ -85,6 +85,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().scalingFactor(scalingFactor); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturation.java index 6fb48c86cf..b7e07967f0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturation.java @@ -90,6 +90,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().pivot(pivot); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoid.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoid.java index f580cc97a7..4c41cd9f31 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoid.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoid.java @@ -98,6 +98,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().pivot(pivot).exponent(exponent); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java index 4cd2e42fba..c2d01d2e80 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java @@ -154,6 +154,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).saturation(saturation).log(log).linear(linear).sigmoid(sigmoid); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java index 6dc48ce92c..25c9b0445f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQuery.java @@ -167,6 +167,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .value(value) + .caseInsensitive(caseInsensitive) + .flags(flags) + .maxDeterminizedStates(maxDeterminizedStates) + .rewrite(rewrite) + .value(value); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java index b50f253c4f..252d6a3217 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQuery.java @@ -85,6 +85,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().script(script); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunction.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunction.java index d69900c913..392cafa45f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunction.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunction.java @@ -85,6 +85,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().script(script); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java index 65e5a89eb4..126309de89 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQuery.java @@ -116,6 +116,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().minScore(minScore).query(query).script(script); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQuery.java index cfb1aeffd7..53a4771a58 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQuery.java @@ -120,9 +120,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.shape != null) { generator.writeKey("shape"); this.shape.serialize(generator, mapper); - } + } + public Builder toBuilder() { + return new Builder().indexedShape(indexedShape).relation(relation).shape(shape); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQuery.java index e4e483888d..019387c174 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQuery.java @@ -112,6 +112,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).shape(shape); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java index 59baa794eb..803230a525 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQuery.java @@ -293,6 +293,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().analyzer(analyzer) + .analyzeWildcard(analyzeWildcard) + .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) + .defaultOperator(defaultOperator) + .fields(fields) + .flags(flags) + .fuzzyMaxExpansions(fuzzyMaxExpansions) + .fuzzyPrefixLength(fuzzyPrefixLength) + .fuzzyTranspositions(fuzzyTranspositions) + .lenient(lenient) + .minimumShouldMatch(minimumShouldMatch) + .query(query) + .quoteFieldSuffix(quoteFieldSuffix); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java index 0993356830..0a24e78415 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQuery.java @@ -105,6 +105,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().big(big).little(little); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java index ea6c30ed44..3908eb21a4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQuery.java @@ -105,6 +105,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).query(query); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java index e9b03a590d..0f7646a8de 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQuery.java @@ -105,6 +105,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().end(end).match(match); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQuery.java index 6ecdaccd4c..8ab44c377a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQuery.java @@ -83,6 +83,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + public Builder toBuilder() { + return new Builder().field(field).spanWidth(spanWidth); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java index 6e8bd4f383..be51d14fc4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQuery.java @@ -95,6 +95,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().match(match); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java index d0eeda0362..69ce1fc39f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQuery.java @@ -136,6 +136,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().clauses(clauses).inOrder(inOrder).slop(slop); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java index 9b31dbf61e..a37941b53f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQuery.java @@ -158,6 +158,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().dist(dist).exclude(exclude).include(include).post(post).pre(pre); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java index 90b9403f6e..a38b1b9159 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQuery.java @@ -101,6 +101,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().clauses(clauses); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQuery.java index a83956560f..f2e3f5b792 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQuery.java @@ -312,10 +312,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder spanContaining(SpanContainingQuery v) { this._kind = Kind.SpanContaining; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java index d76e10593d..0d8772fe3c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQuery.java @@ -106,6 +106,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).value(value); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java index 34dbe6e97f..3a1c6a8cf4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQuery.java @@ -105,6 +105,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().big(big).little(little); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java index cb7a6c31fd..589ec8da8b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermQuery.java @@ -118,6 +118,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).value(value).caseInsensitive(caseInsensitive); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookup.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookup.java index d3a00d286a..5a26eeb2c8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookup.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookup.java @@ -130,6 +130,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().index(index).id(id).path(path).routing(routing); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java index 94440e190a..0319969897 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQuery.java @@ -93,6 +93,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).terms(terms); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryField.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryField.java index 75d9379820..baaf2b0555 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryField.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryField.java @@ -41,6 +41,8 @@ import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.UnionDeserializer; import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch._types.query_dsl.SpanQuery.Builder; +import org.opensearch.client.opensearch._types.query_dsl.SpanQuery.Kind; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -141,10 +143,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder()._kind(_kind)._value(_value); + } + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private Object _value; + protected final Builder _kind(Kind v) { + this._kind = v; + return this; + } + + protected final Builder _value(Object v) { + this._value = v; + return this; + } + public ObjectBuilder value(List v) { this._kind = Kind.Value; this._value = v; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java index c6eb8c1a03..78e365173e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQuery.java @@ -143,6 +143,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field) + .minimumShouldMatchField(minimumShouldMatchField) + .minimumShouldMatchScript(minimumShouldMatchScript) + .terms(terms); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java index ff69276fa6..215eccca14 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQuery.java @@ -84,6 +84,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().value(value); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java index 30463a4f43..724f933829 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQuery.java @@ -167,6 +167,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().field(field).value(value).caseInsensitive(caseInsensitive).rewrite(rewrite).value(value).wildcard(wildcard); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java index 9ca6ab49fd..b87ea9b3fc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQuery.java @@ -87,6 +87,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().query(query); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/BulkRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/BulkRequest.java index a1424891df..2834e4fb1b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/BulkRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/BulkRequest.java @@ -252,6 +252,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .index(index) + .pipeline(pipeline) + .refresh(refresh) + .requireAlias(requireAlias) + .routing(routing) + .timeout(timeout) + .waitForActiveShards(waitForActiveShards) + .operations(operations); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ClearScrollRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ClearScrollRequest.java index cdc60d9114..dd2e47066a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ClearScrollRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ClearScrollRequest.java @@ -104,6 +104,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().scrollId(scrollId); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java index ed09854919..f382e3677b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java @@ -323,6 +323,25 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .analyzeWildcard(analyzeWildcard) + .analyzer(analyzer) + .defaultOperator(defaultOperator) + .df(df) + .expandWildcards(expandWildcards) + .ignoreThrottled(ignoreThrottled) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .lenient(lenient) + .minScore(minScore) + .preference(preference) + .q(q) + .query(query) + .routing(routing) + .terminateAfter(terminateAfter); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/CreateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/CreateRequest.java index 62a02ca9a1..b29dce5680 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/CreateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/CreateRequest.java @@ -229,6 +229,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().id(id) + .index(index) + .pipeline(pipeline) + .refresh(refresh) + .routing(routing) + .timeout(timeout) + .version(version) + .versionType(versionType) + .waitForActiveShards(waitForActiveShards) + .document(document) + .tDocumentSerializer(tDocumentSerializer); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java index b69fb06086..67d6df63c7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java @@ -616,6 +616,45 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .allowNoIndices(allowNoIndices) + .analyzeWildcard(analyzeWildcard) + .analyzer(analyzer) + .conflicts(conflicts) + .defaultOperator(defaultOperator) + .df(df) + .expandWildcards(expandWildcards) + .from(from) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .lenient(lenient) + .maxDocs(maxDocs) + .preference(preference) + .q(q) + .query(query) + .refresh(refresh) + .requestCache(requestCache) + .requestsPerSecond(requestsPerSecond) + .routing(routing) + .scroll(scroll) + .scrollSize(scrollSize) + .searchTimeout(searchTimeout) + .searchType(searchType) + .size(size) + .slice(slice) + .slices(slices) + .sort(sort) + .stats(stats) + .terminateAfter(terminateAfter) + .timeout(timeout) + .version(version) + .waitForActiveShards(waitForActiveShards) + .waitForCompletion(waitForCompletion); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequest.java index 32715c216e..42493be3c7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequest.java @@ -91,6 +91,10 @@ public final String taskId() { return this.taskId; } + public Builder toBuilder() { + return new Builder().requestsPerSecond(requestsPerSecond).taskId(taskId); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteRequest.java index 1aa54a5003..066c17235f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteRequest.java @@ -212,6 +212,19 @@ public final WaitForActiveShards waitForActiveShards() { return this.waitForActiveShards; } + public Builder toBuilder() { + return new Builder().id(id) + .ifPrimaryTerm(ifPrimaryTerm) + .ifSeqNo(ifSeqNo) + .index(index) + .refresh(refresh) + .routing(routing) + .timeout(timeout) + .version(version) + .versionType(versionType) + .waitForActiveShards(waitForActiveShards); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteScriptRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteScriptRequest.java index 17f6ff6682..9c988664ee 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteScriptRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteScriptRequest.java @@ -119,6 +119,10 @@ public final Time timeout() { return this.timeout; } + public Builder toBuilder() { + return new Builder().id(id).masterTimeout(masterTimeout).clusterManagerTimeout(clusterManagerTimeout).timeout(timeout); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsRequest.java index 71a92cdc1b..7c3c038b48 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsRequest.java @@ -229,6 +229,21 @@ public final VersionType versionType() { return this.versionType; } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .id(id) + .index(index) + .preference(preference) + .realtime(realtime) + .refresh(refresh) + .routing(routing) + .storedFields(storedFields) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsSourceRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsSourceRequest.java index 3af5df4346..220d66820a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsSourceRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExistsSourceRequest.java @@ -217,6 +217,20 @@ public final VersionType versionType() { return this.versionType; } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .id(id) + .index(index) + .preference(preference) + .realtime(realtime) + .refresh(refresh) + .routing(routing) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExplainRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExplainRequest.java index 1b6ae3392e..bcf2c9eb79 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ExplainRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ExplainRequest.java @@ -296,6 +296,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .analyzeWildcard(analyzeWildcard) + .analyzer(analyzer) + .defaultOperator(defaultOperator) + .df(df) + .id(id) + .index(index) + .lenient(lenient) + .preference(preference) + .q(q) + .query(query) + .routing(routing) + .storedFields(storedFields); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/FieldCapsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/FieldCapsRequest.java index 224c9da095..3800124290 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/FieldCapsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/FieldCapsRequest.java @@ -211,6 +211,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .expandWildcards(expandWildcards) + .fields(fields) + .ignoreUnavailable(ignoreUnavailable) + .includeUnmapped(includeUnmapped) + .index(index) + .indexFilter(indexFilter) + .runtimeMappings(runtimeMappings); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetRequest.java index 2a04947f04..b6cfd36716 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetRequest.java @@ -230,6 +230,21 @@ public final VersionType versionType() { return this.versionType; } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .id(id) + .index(index) + .preference(preference) + .realtime(realtime) + .refresh(refresh) + .routing(routing) + .storedFields(storedFields) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java index d1f7d338f0..4f820076ca 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java @@ -106,6 +106,10 @@ public final Time clusterManagerTimeout() { return this.clusterManagerTimeout; } + public Builder toBuilder() { + return new Builder().id(id).masterTimeout(masterTimeout).clusterManagerTimeout(clusterManagerTimeout); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java index 157c0001b0..871d25e641 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java @@ -227,6 +227,21 @@ public final VersionType versionType() { return this.versionType; } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .id(id) + .index(index) + .preference(preference) + .realtime(realtime) + .refresh(refresh) + .routing(routing) + .storedFields(storedFields) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java index 935e2a02ff..2479acd17d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java @@ -289,6 +289,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().id(id) + .ifPrimaryTerm(ifPrimaryTerm) + .ifSeqNo(ifSeqNo) + .index(index) + .opType(opType) + .pipeline(pipeline) + .refresh(refresh) + .requireAlias(requireAlias) + .routing(routing) + .timeout(timeout) + .version(version) + .versionType(versionType) + .waitForActiveShards(waitForActiveShards) + .document(document) + .tDocumentSerializer(tDocumentSerializer); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java index c3588f21d2..3133d4433b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java @@ -250,6 +250,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .docs(docs) + .ids(ids) + .index(index) + .preference(preference) + .realtime(realtime) + .refresh(refresh) + .routing(routing) + .storedFields(storedFields); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java index 72a0d5ccdd..931be38b15 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchRequest.java @@ -254,6 +254,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) + .expandWildcards(expandWildcards) + .ignoreThrottled(ignoreThrottled) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .maxConcurrentSearches(maxConcurrentSearches) + .maxConcurrentShardRequests(maxConcurrentShardRequests) + .preFilterShardSize(preFilterShardSize) + .searchType(searchType) + .searches(searches); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java index f1dbd8e217..a493db0abc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java @@ -159,6 +159,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) + .index(index) + .maxConcurrentSearches(maxConcurrentSearches) + .searchType(searchType) + .searchTemplates(searchTemplates); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java index 8369038be4..caa971a1fb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java @@ -309,6 +309,23 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().docs(docs) + .fieldStatistics(fieldStatistics) + .fields(fields) + .ids(ids) + .index(index) + .offsets(offsets) + .payloads(payloads) + .positions(positions) + .preference(preference) + .realtime(realtime) + .routing(routing) + .termStatistics(termStatistics) + .version(version) + .versionType(versionType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/PutScriptRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/PutScriptRequest.java index cf5f9ba3a4..787e18fa29 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/PutScriptRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/PutScriptRequest.java @@ -168,6 +168,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().context(context) + .id(id) + .masterTimeout(masterTimeout) + .clusterManagerTimeout(clusterManagerTimeout) + .script(script) + .timeout(timeout); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/RankEvalRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/RankEvalRequest.java index c8d48ff56a..ca339ab2a4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/RankEvalRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/RankEvalRequest.java @@ -206,6 +206,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .expandWildcards(expandWildcards) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .metric(metric) + .requests(requests) + .searchType(searchType); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRequest.java index 15e1998f11..49ae533cd7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRequest.java @@ -309,6 +309,23 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().conflicts(conflicts) + .dest(dest) + .maxDocs(maxDocs) + .refresh(refresh) + .requestsPerSecond(requestsPerSecond) + .requireAlias(requireAlias) + .script(script) + .scroll(scroll) + .size(size) + .slices(slices) + .source(source) + .timeout(timeout) + .waitForActiveShards(waitForActiveShards) + .waitForCompletion(waitForCompletion); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequest.java index 71b506b24b..d6ccc65689 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequest.java @@ -90,6 +90,10 @@ public final String taskId() { return this.taskId; } + public Builder toBuilder() { + return new Builder().requestsPerSecond(requestsPerSecond).taskId(taskId); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequest.java index dfb02f44ff..a393df9135 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequest.java @@ -154,6 +154,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().file(file).id(id).params(params).source(source); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java index a59a4dcfc2..57e2baf40d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java @@ -135,6 +135,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().context(context).contextSetup(contextSetup).script(script); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java index d4c7d534fd..4535fda3f7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java @@ -117,6 +117,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().scroll(scroll).scrollId(scrollId); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java index 852415b0a2..ce0bd8b185 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java @@ -1051,6 +1051,61 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .aggregations(aggregations) + .allowNoIndices(allowNoIndices) + .allowPartialSearchResults(allowPartialSearchResults) + .analyzeWildcard(analyzeWildcard) + .analyzer(analyzer) + .batchedReduceSize(batchedReduceSize) + .ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) + .collapse(collapse) + .defaultOperator(defaultOperator) + .df(df) + .docvalueFields(docvalueFields) + .expandWildcards(expandWildcards) + .explain(explain) + .fields(fields) + .from(from) + .highlight(highlight) + .ignoreThrottled(ignoreThrottled) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .indicesBoost(indicesBoost) + .lenient(lenient) + .maxConcurrentShardRequests(maxConcurrentShardRequests) + .minCompatibleShardNode(minCompatibleShardNode) + .minScore(minScore) + .pit(pit) + .postFilter(postFilter) + .preFilterShardSize(preFilterShardSize) + .preference(preference) + .profile(profile) + .q(q) + .query(query) + .requestCache(requestCache) + .rescore(rescore) + .routing(routing) + .runtimeMappings(runtimeMappings) + .scriptFields(scriptFields) + .scroll(scroll) + .searchAfter(searchAfter) + .searchType(searchType) + .seqNoPrimaryTerm(seqNoPrimaryTerm) + .size(size) + .slice(slice) + .sort(sort) + .stats(stats) + .storedFields(storedFields) + .suggest(suggest) + .terminateAfter(terminateAfter) + .timeout(timeout) + .trackScores(trackScores) + .trackTotalHits(trackTotalHits) + .version(version); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchShardsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchShardsRequest.java index d04c118c50..55758f7565 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchShardsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchShardsRequest.java @@ -168,6 +168,16 @@ public final String routing() { return this.routing; } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .expandWildcards(expandWildcards) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .local(local) + .preference(preference) + .routing(routing); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchTemplateRequest.java index 19fbda0a50..181415cd01 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchTemplateRequest.java @@ -331,6 +331,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().allowNoIndices(allowNoIndices) + .ccsMinimizeRoundtrips(ccsMinimizeRoundtrips) + .expandWildcards(expandWildcards) + .explain(explain) + .id(id) + .ignoreThrottled(ignoreThrottled) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .params(params) + .preference(preference) + .profile(profile) + .routing(routing) + .scroll(scroll) + .searchType(searchType) + .source(source); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java index 97d669edfa..53669c4c1d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java @@ -233,6 +233,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().caseInsensitive(caseInsensitive) + .field(field) + .index(index) + .indexFilter(indexFilter) + .searchAfter(searchAfter) + .size(size) + .string(string) + .timeout(timeout); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java index 1780119dd3..5e3307f387 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java @@ -333,6 +333,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().doc(doc) + .fieldStatistics(fieldStatistics) + .fields(fields) + .filter(filter) + .id(id) + .index(index) + .offsets(offsets) + .payloads(payloads) + .perFieldAnalyzer(perFieldAnalyzer) + .positions(positions) + .preference(preference) + .realtime(realtime) + .routing(routing) + .termStatistics(termStatistics) + .version(version) + .versionType(versionType) + .tDocumentSerializer(tDocumentSerializer); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java index ad288100d2..0c8fe2f221 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java @@ -653,6 +653,47 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .sourceExcludes(sourceExcludes) + .sourceIncludes(sourceIncludes) + .allowNoIndices(allowNoIndices) + .analyzeWildcard(analyzeWildcard) + .analyzer(analyzer) + .conflicts(conflicts) + .defaultOperator(defaultOperator) + .df(df) + .expandWildcards(expandWildcards) + .from(from) + .ignoreUnavailable(ignoreUnavailable) + .index(index) + .lenient(lenient) + .maxDocs(maxDocs) + .pipeline(pipeline) + .preference(preference) + .query(query) + .refresh(refresh) + .requestCache(requestCache) + .requestsPerSecond(requestsPerSecond) + .routing(routing) + .script(script) + .scroll(scroll) + .scrollSize(scrollSize) + .searchTimeout(searchTimeout) + .searchType(searchType) + .size(size) + .slice(slice) + .slices(slices) + .sort(sort) + .stats(stats) + .terminateAfter(terminateAfter) + .timeout(timeout) + .version(version) + .versionType(versionType) + .waitForActiveShards(waitForActiveShards) + .waitForCompletion(waitForCompletion); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequest.java index f11a0d4a32..9724dd038c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequest.java @@ -91,6 +91,10 @@ public final String taskId() { return this.taskId; } + public Builder toBuilder() { + return new Builder().requestsPerSecond(requestsPerSecond).taskId(taskId); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateRequest.java index 5b95213b55..7685604b83 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateRequest.java @@ -395,6 +395,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + public Builder toBuilder() { + return new Builder().source(source) + .detectNoop(detectNoop) + .doc(doc) + .docAsUpsert(docAsUpsert) + .id(id) + .ifPrimaryTerm(ifPrimaryTerm) + .ifSeqNo(ifSeqNo) + .index(index) + .lang(lang) + .refresh(refresh) + .requireAlias(requireAlias) + .retryOnConflict(retryOnConflict) + .routing(routing) + .script(script) + .scriptedUpsert(scriptedUpsert) + .timeout(timeout) + .upsert(upsert) + .waitForActiveShards(waitForActiveShards) + .tDocumentSerializer(tDocumentSerializer) + .tPartialDocumentSerializer(tPartialDocumentSerializer); + } + // --------------------------------------------------------------------------------------------- /** diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQueryTest.java new file mode 100644 index 0000000000..d30dc30b31 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoolQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class BoolQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + BoolQuery origin = new BoolQuery.Builder().must(buildDummyQuery()).build(); + BoolQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java new file mode 100644 index 0000000000..55c6b14544 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/BoostringQueryTest.java @@ -0,0 +1,26 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class BoostringQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + BoostingQuery origin = new BoostingQuery.Builder().negativeBoost(1.0f) + .negative(buildDummyQuery()) + .positive(buildDummyQuery()) + .build(); + BoostingQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQueryTest.java new file mode 100644 index 0000000000..0f154c40c6 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CombinedFieldsQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class CombinedFieldsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + CombinedFieldsQuery origin = new CombinedFieldsQuery.Builder().fields("field").query("query").build(); + CombinedFieldsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQueryTest.java new file mode 100644 index 0000000000..86f7c0b8a7 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/CommonTermsQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class CommonTermsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + CommonTermsQuery origin = new CommonTermsQuery.Builder().query("query").field("field").build(); + CommonTermsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunctionTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunctionTest.java new file mode 100644 index 0000000000..2a3d2ce3d4 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayFunctionTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class DecayFunctionTest extends ModelTestCase { + @Test + public void toBuilder() { + DecayFunction origin = new DecayFunction.Builder().field("field").placement(new DecayPlacement.Builder().build()).build(); + DecayFunction copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacementTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacementTest.java new file mode 100644 index 0000000000..962a76db11 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DecayPlacementTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class DecayPlacementTest extends ModelTestCase { + @Test + public void toBuilder() { + DecayPlacement origin = new DecayPlacement.Builder().build(); + DecayPlacement copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQueryTest.java new file mode 100644 index 0000000000..24b6388462 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DisMaxQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class DisMaxQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + DisMaxQuery origin = new DisMaxQuery.Builder().queries(buildDummyQuery()).build(); + DisMaxQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQueryTest.java new file mode 100644 index 0000000000..04e6b0af33 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/DistanceFeatureQueryTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class DistanceFeatureQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + DistanceFeatureQuery origin = new DistanceFeatureQuery.Builder().origin(JsonData.of("{}")) + .pivot(JsonData.of("{}")) + .field("field") + .build(); + DistanceFeatureQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQueryTest.java new file mode 100644 index 0000000000..10bc217bb8 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ExistsQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ExistsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ExistsQuery origin = new ExistsQuery.Builder().field("field").build(); + ExistsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormatTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormatTest.java new file mode 100644 index 0000000000..60e025e80f --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldAndFormatTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class FieldAndFormatTest extends ModelTestCase { + @Test + public void toBuilder() { + FieldAndFormat origin = new FieldAndFormat.Builder().field("field").build(); + FieldAndFormat copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookupTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookupTest.java new file mode 100644 index 0000000000..3e3b4c8096 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldLookupTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class FieldLookupTest extends ModelTestCase { + @Test + public void toBuilder() { + FieldLookup origin = new FieldLookup.Builder().id("id").build(); + FieldLookup copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunctionTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunctionTest.java new file mode 100644 index 0000000000..cff8d3fe58 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FieldValueFactorScoreFunctionTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class FieldValueFactorScoreFunctionTest extends ModelTestCase { + @Test + public void toBuilder() { + FieldValueFactorScoreFunction origin = new FieldValueFactorScoreFunction.Builder().field("field").build(); + FieldValueFactorScoreFunction copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQueryTest.java new file mode 100644 index 0000000000..491894ee2c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FunctionScoreQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class FunctionScoreQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + FunctionScoreQuery origin = new FunctionScoreQuery.Builder().build(); + FunctionScoreQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQueryTest.java new file mode 100644 index 0000000000..59be3fd116 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/FuzzyQueryTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class FuzzyQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + FuzzyQuery origin = new FuzzyQuery.Builder().field("field").value(FieldValue.of("value")).build(); + FuzzyQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQueryTest.java new file mode 100644 index 0000000000..be0420ff76 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoBoundingBoxQueryTest.java @@ -0,0 +1,20 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.CoordsGeoBounds; +import org.opensearch.client.opensearch._types.GeoBounds; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class GeoBoundingBoxQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + GeoBoundingBoxQuery origin = new GeoBoundingBoxQuery.Builder().field("field") + .boundingBox( + new GeoBounds.Builder().coords(new CoordsGeoBounds.Builder().top(1.0f).bottom(1.0f).left(1.0f).right(1.0f).build()).build() + ) + .build(); + GeoBoundingBoxQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQueryTest.java new file mode 100644 index 0000000000..edaa9edf56 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoDistanceQueryTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch._types.GeoLocation; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class GeoDistanceQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + GeoDistanceQuery origin = new GeoDistanceQuery.Builder().field("field") + .location(new GeoLocation.Builder().coords(List.of(1.0)).build()) + .build(); + GeoDistanceQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPointsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPointsTest.java new file mode 100644 index 0000000000..2b07f77787 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoPolygonPointsTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.GeoLocation; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class GeoPolygonPointsTest extends ModelTestCase { + @Test + public void toBuilder() { + GeoPolygonPoints origin = new GeoPolygonPoints.Builder().points(new GeoLocation.Builder().text("text").build()).build(); + GeoPolygonPoints copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQueryTest.java new file mode 100644 index 0000000000..f60cd91aa0 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/GeoShapeFieldQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class GeoShapeFieldQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + GeoShapeFieldQuery origin = new GeoShapeFieldQuery.Builder().build(); + GeoShapeFieldQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQueryTest.java new file mode 100644 index 0000000000..f88f9881c4 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasChildQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class HasChildQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + HasChildQuery origin = new HasChildQuery.Builder().query(buildDummyQuery()).type("type").build(); + HasChildQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQueryTest.java new file mode 100644 index 0000000000..93afb418e8 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/HasParentQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class HasParentQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + HasParentQuery origin = new HasParentQuery.Builder().query(buildDummyQuery()).parentType("parentType").build(); + HasParentQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQueryTest.java new file mode 100644 index 0000000000..12f2697de1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IdsQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IdsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + IdsQuery origin = new IdsQuery.Builder().build(); + IdsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOfTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOfTest.java new file mode 100644 index 0000000000..3245382437 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAllOfTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsAllOfTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsAllOf origin = new IntervalsAllOf.Builder().intervals( + new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build() + ).build(); + IntervalsAllOf copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOfTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOfTest.java new file mode 100644 index 0000000000..8214e7274d --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsAnyOfTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsAnyOfTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsAnyOf origin = new IntervalsAnyOf.Builder().intervals( + new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build() + ).build(); + IntervalsAnyOf copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterTest.java new file mode 100644 index 0000000000..3b51e96f7f --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFilterTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsFilterTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsFilter origin = new IntervalsFilter.Builder().after( + new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build() + ).build(); + IntervalsFilter copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzyTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzyTest.java new file mode 100644 index 0000000000..9a68139a2c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsFuzzyTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsFuzzyTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsFuzzy origin = new IntervalsFuzzy.Builder().term("term").fuzziness("fuzziness").build(); + IntervalsFuzzy copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatchTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatchTest.java new file mode 100644 index 0000000000..ac42989c2e --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsMatchTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsMatchTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsMatch origin = new IntervalsMatch.Builder().query("query").build(); + IntervalsMatch copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefixTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefixTest.java new file mode 100644 index 0000000000..251302ba24 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsPrefixTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsPrefixTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsPrefix origin = new IntervalsPrefix.Builder().prefix("prefix").build(); + IntervalsPrefix copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryTest.java new file mode 100644 index 0000000000..a467b9c665 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsQueryTest.java @@ -0,0 +1,20 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsQuery origin = new IntervalsQuery.Builder().field("field") + .allOf( + new IntervalsAllOf.Builder().intervals( + new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build() + ).build() + ) + .build(); + IntervalsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsTest.java new file mode 100644 index 0000000000..c2bda0b440 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsTest extends ModelTestCase { + @Test + public void toBuilder() { + Intervals origin = new Intervals.Builder().match(new IntervalsMatch.Builder().query("query").build()).build(); + Intervals copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcardTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcardTest.java new file mode 100644 index 0000000000..b24a16f21f --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/IntervalsWildcardTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class IntervalsWildcardTest extends ModelTestCase { + @Test + public void toBuilder() { + IntervalsWildcard origin = new IntervalsWildcard.Builder().useField("useField").pattern("pattern").build(); + IntervalsWildcard copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQueryTest.java new file mode 100644 index 0000000000..df036f42c1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/KnnQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class KnnQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + KnnQuery origin = new KnnQuery.Builder().field("field").vector(new float[] { 1.0f }).k(1).build(); + KnnQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocumentTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocumentTest.java new file mode 100644 index 0000000000..dd610c1bcd --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeDocumentTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class LikeDocumentTest extends ModelTestCase { + @Test + public void toBuilder() { + LikeDocument origin = new LikeDocument.Builder().id("1").build(); + LikeDocument copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeTest.java new file mode 100644 index 0000000000..7197d16d59 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/LikeTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class LikeTest extends ModelTestCase { + @Test + public void toBuilder() { + Like origin = new Like.Builder().text("text").build(); + Like copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQueryTest.java new file mode 100644 index 0000000000..06bde14854 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchBoolPrefixQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MatchBoolPrefixQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MatchBoolPrefixQuery origin = new MatchBoolPrefixQuery.Builder().field("field").query("query").build(); + MatchBoolPrefixQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQueryTest.java new file mode 100644 index 0000000000..83e6a70215 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhrasePrefixQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MatchPhrasePrefixQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MatchPhrasePrefixQuery origin = new MatchPhrasePrefixQuery.Builder().field("field").query("query").build(); + MatchPhrasePrefixQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQueryTest.java new file mode 100644 index 0000000000..1583dc7cc5 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchPhraseQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MatchPhraseQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MatchPhraseQuery origin = new MatchPhraseQuery.Builder().field("field").query("query").build(); + MatchPhraseQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java new file mode 100644 index 0000000000..95f97f9332 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MatchQueryTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MatchQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MatchQuery origin = new MatchQuery.Builder().field("field").query(FieldValue.of("1")).build(); + MatchQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQueryTest.java new file mode 100644 index 0000000000..52c173ac35 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MoreLikeThisQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MoreLikeThisQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MoreLikeThisQuery origin = new MoreLikeThisQuery.Builder().like(new Like.Builder().text("text").build()).build(); + MoreLikeThisQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQueryTest.java new file mode 100644 index 0000000000..3d73e694e0 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/MultiMatchQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class MultiMatchQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + MultiMatchQuery origin = new MultiMatchQuery.Builder().query("query").build(); + MultiMatchQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQueryTest.java new file mode 100644 index 0000000000..a0908cc88d --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NestedQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class NestedQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + NestedQuery origin = new NestedQuery.Builder().query(buildDummyQuery()).path("path").build(); + NestedQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java new file mode 100644 index 0000000000..710c639693 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/NeuralQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class NeuralQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + NeuralQuery origin = new NeuralQuery.Builder().field("field").queryText("queryText").k(1).build(); + NeuralQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQueryTest.java new file mode 100644 index 0000000000..d1acb81bf1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ParentIdQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ParentIdQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ParentIdQuery origin = new ParentIdQuery.Builder().id("id").build(); + ParentIdQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQueryTest.java new file mode 100644 index 0000000000..fa5ce508db --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PercolateQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class PercolateQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + PercolateQuery origin = new PercolateQuery.Builder().id("id").field("field").build(); + PercolateQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDocTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDocTest.java new file mode 100644 index 0000000000..86f7f1d279 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedDocTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class PinnedDocTest extends ModelTestCase { + @Test + public void toBuilder() { + PinnedDoc origin = new PinnedDoc.Builder().index("index").id("id").build(); + PinnedDoc copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQueryTest.java new file mode 100644 index 0000000000..3c779919de --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PinnedQueryTest.java @@ -0,0 +1,24 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class PinnedQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + PinnedQuery origin = new PinnedQuery.Builder().organic(buildDummyQuery()).ids(List.of("1")).build(); + PinnedQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQueryTest.java new file mode 100644 index 0000000000..53d061f467 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/PrefixQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class PrefixQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + PrefixQuery origin = new PrefixQuery.Builder().field("field").value("value").build(); + PrefixQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQueryTest.java new file mode 100644 index 0000000000..07a5ebb4bc --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryStringQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class QueryStringQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + QueryStringQuery origin = new QueryStringQuery.Builder().query("query").build(); + QueryStringQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryTest.java new file mode 100644 index 0000000000..6c06c0a9a3 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/QueryTest.java @@ -0,0 +1,19 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class QueryTest extends ModelTestCase { + @Test + public void toBuilder() { + Query origin = Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + Query copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunctionTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunctionTest.java new file mode 100644 index 0000000000..6dd1bd0b94 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RandomScoreFunctionTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RandomScoreFunctionTest extends ModelTestCase { + @Test + public void toBuilder() { + RandomScoreFunction origin = new RandomScoreFunction.Builder().seed("seed").build(); + RandomScoreFunction copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQueryTest.java new file mode 100644 index 0000000000..3ccbce81f8 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RangeQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RangeQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + RangeQuery origin = new RangeQuery.Builder().field("field").build(); + RangeQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithmTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithmTest.java new file mode 100644 index 0000000000..c55908ae21 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionLogarithmTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RankFeatureFunctionLogarithmTest extends ModelTestCase { + @Test + public void toBuilder() { + RankFeatureFunctionLogarithm origin = new RankFeatureFunctionLogarithm.Builder().scalingFactor(1.0f).build(); + RankFeatureFunctionLogarithm copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturationTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturationTest.java new file mode 100644 index 0000000000..5174147186 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSaturationTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RankFeatureFunctionSaturationTest extends ModelTestCase { + @Test + public void toBuilder() { + RankFeatureFunctionSaturation origin = new RankFeatureFunctionSaturation.Builder().pivot(1.0f).build(); + RankFeatureFunctionSaturation copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoidTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoidTest.java new file mode 100644 index 0000000000..aaf51173cf --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureFunctionSigmoidTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RankFeatureFunctionSigmoidTest extends ModelTestCase { + @Test + public void toBuilder() { + RankFeatureFunctionSigmoid origin = new RankFeatureFunctionSigmoid.Builder().exponent(1.0f).pivot(1.0f).build(); + RankFeatureFunctionSigmoid copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQueryTest.java new file mode 100644 index 0000000000..0abb4e8278 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RankFeatureQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + RankFeatureQuery origin = new RankFeatureQuery.Builder().field("field").build(); + RankFeatureQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQueryTest.java new file mode 100644 index 0000000000..de4285b018 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/RegexpQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class RegexpQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + RegexpQuery origin = new RegexpQuery.Builder().field("field").value("value").build(); + RegexpQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQueryTest.java new file mode 100644 index 0000000000..15844bdc87 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptQueryTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.InlineScript; +import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ScriptQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ScriptQuery origin = new ScriptQuery.Builder().script( + new Script.Builder().inline(new InlineScript.Builder().source("source").build()).build() + ).build(); + ScriptQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunctionTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunctionTest.java new file mode 100644 index 0000000000..544d8c79cd --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreFunctionTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.InlineScript; +import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ScriptScoreFunctionTest extends ModelTestCase { + @Test + public void toBuilder() { + ScriptScoreFunction origin = new ScriptScoreFunction.Builder().script( + new Script.Builder().inline(new InlineScript.Builder().source("source").build()).build() + ).build(); + ScriptScoreFunction copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQueryTest.java new file mode 100644 index 0000000000..8ab13f4f48 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ScriptScoreQueryTest.java @@ -0,0 +1,27 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch._types.InlineScript; +import org.opensearch.client.opensearch._types.Script; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ScriptScoreQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ScriptScoreQuery origin = new ScriptScoreQuery.Builder().query(buildDummyQuery()) + .script(new Script.Builder().inline(new InlineScript.Builder().source("source").build()).build()) + .build(); + ScriptScoreQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQueryTest.java new file mode 100644 index 0000000000..9d80ad39d6 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeFieldQueryTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ShapeFieldQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ShapeFieldQuery origin = new ShapeFieldQuery.Builder().shape(JsonData.of("{}")).build(); + ShapeFieldQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQueryTest.java new file mode 100644 index 0000000000..c6de52792d --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/ShapeQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class ShapeQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + ShapeQuery origin = new ShapeQuery.Builder().field("field") + .shape(new ShapeFieldQuery.Builder().shape(JsonData.of("{}")).build()) + .build(); + ShapeQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQueryTest.java new file mode 100644 index 0000000000..c5638024e4 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SimpleQueryStringQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SimpleQueryStringQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SimpleQueryStringQuery origin = new SimpleQueryStringQuery.Builder().query("query").build(); + SimpleQueryStringQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQueryTest.java new file mode 100644 index 0000000000..fabb167771 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanContainingQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanContainingQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanContainingQuery origin = new SpanContainingQuery.Builder().big( + new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build() + ).little(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()).build(); + SpanContainingQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQueryTest.java new file mode 100644 index 0000000000..af176824f7 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFieldMaskingQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanFieldMaskingQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanFieldMaskingQuery origin = new SpanFieldMaskingQuery.Builder().field("field") + .query(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()) + .build(); + SpanFieldMaskingQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQueryTest.java new file mode 100644 index 0000000000..3b0fbac20c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanFirstQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanFirstQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanFirstQuery origin = new SpanFirstQuery.Builder().end(1) + .match(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()) + .build(); + SpanFirstQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQueryTest.java new file mode 100644 index 0000000000..5b43edaec0 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanGapQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanGapQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanGapQuery origin = new SpanGapQuery.Builder().field("field").spanWidth(1).build(); + SpanGapQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQueryTest.java new file mode 100644 index 0000000000..2199e65b9b --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanMultiTermQueryTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanMultiTermQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanMultiTermQuery origin = new SpanMultiTermQuery.Builder().match(buildDummyQuery()).build(); + SpanMultiTermQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQueryTest.java new file mode 100644 index 0000000000..ffff730cf1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNearQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanNearQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanNearQuery origin = new SpanNearQuery.Builder().clauses( + List.of(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()) + ).build(); + SpanNearQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQueryTest.java new file mode 100644 index 0000000000..2a2757d1a6 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanNotQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanNotQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanNotQuery origin = new SpanNotQuery.Builder().include( + new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build() + ).exclude(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()).build(); + SpanNotQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQueryTest.java new file mode 100644 index 0000000000..407c0717c9 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanOrQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanOrQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanOrQuery origin = new SpanOrQuery.Builder().clauses( + List.of(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()) + ).build(); + SpanOrQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryTest.java new file mode 100644 index 0000000000..5d941045ee --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanQueryTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanQuery origin = new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build(); + SpanQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQueryTest.java new file mode 100644 index 0000000000..46a361ae57 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanTermQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanTermQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanTermQuery origin = new SpanTermQuery.Builder().field("field").value("value").build(); + SpanTermQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQueryTest.java new file mode 100644 index 0000000000..ce71e79c33 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/SpanWithinQueryTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SpanWithinQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + SpanWithinQuery origin = new SpanWithinQuery.Builder().big( + new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build() + ).little(new SpanQuery.Builder().spanOr(new SpanOrQuery.Builder().clauses(List.of()).build()).build()).build(); + SpanWithinQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermQueryTest.java new file mode 100644 index 0000000000..22c298a3eb --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermQueryTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TermQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + TermQuery origin = new TermQuery.Builder().field("field").value(FieldValue.of("1")).build(); + TermQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookupTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookupTest.java new file mode 100644 index 0000000000..98c5ae6716 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsLookupTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TermsLookupTest extends ModelTestCase { + @Test + public void toBuilder() { + TermsLookup origin = new TermsLookup.Builder().id("id").index("index").path("path").build(); + TermsLookup copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryFieldTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryFieldTest.java new file mode 100644 index 0000000000..41fb249d51 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryFieldTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TermsQueryFieldTest extends ModelTestCase { + @Test + public void toBuilder() { + TermsQueryField origin = new TermsQueryField.Builder().value(List.of(FieldValue.of("1"))).build(); + TermsQueryField copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryTest.java new file mode 100644 index 0000000000..a8bea25397 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsQueryTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import java.util.List; +import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TermsQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + TermsQuery origin = new TermsQuery.Builder().field("field") + .terms(new TermsQueryField.Builder().value(List.of(FieldValue.of("1"))).build()) + .build(); + TermsQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQueryTest.java new file mode 100644 index 0000000000..b3a028ccb1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TermsSetQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TermsSetQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + TermsSetQuery origin = new TermsSetQuery.Builder().field("field").terms("terms").build(); + TermsSetQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQueryTest.java new file mode 100644 index 0000000000..e41fe389a5 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/TypeQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class TypeQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + TypeQuery origin = new TypeQuery.Builder().value("value").build(); + TypeQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQueryTest.java new file mode 100644 index 0000000000..75880402bd --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WildcardQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class WildcardQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + WildcardQuery origin = new WildcardQuery.Builder().field("field").value("value").build(); + WildcardQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQueryTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQueryTest.java new file mode 100644 index 0000000000..79a2e1457f --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/_types/query_dsl/WrapperQueryTest.java @@ -0,0 +1,14 @@ +package org.opensearch.client.opensearch._types.query_dsl; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class WrapperQueryTest extends ModelTestCase { + @Test + public void toBuilder() { + WrapperQuery origin = new WrapperQuery.Builder().query("query").build(); + WrapperQuery copied = origin.toBuilder().build(); + + assertEquals(toJson(copied), toJson(origin)); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/BulkRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/BulkRequestTest.java new file mode 100644 index 0000000000..c173f1482d --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/BulkRequestTest.java @@ -0,0 +1,20 @@ +package org.opensearch.client.opensearch.core; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; +import org.opensearch.client.opensearch.core.bulk.BulkOperation; +import org.opensearch.client.opensearch.core.bulk.DeleteOperation; + +public class BulkRequestTest extends Assert { + + @Test + public void toBuilder() { + BulkRequest origin = new BulkRequest.Builder().index("index") + .operations(List.of(new BulkOperation.Builder().delete(new DeleteOperation.Builder().id("id").build()).build())) + .build(); + BulkRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ClearScrollRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ClearScrollRequestTest.java new file mode 100644 index 0000000000..cc80c857d7 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ClearScrollRequestTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch.core; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +public class ClearScrollRequestTest extends Assert { + + @Test + public void toBuilder() { + ClearScrollRequest origin = new ClearScrollRequest.Builder().scrollId(List.of("1")).build(); + ClearScrollRequest copied = origin.toBuilder().build(); + + assertEquals(copied.scrollId(), origin.scrollId()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/CountRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/CountRequestTest.java new file mode 100644 index 0000000000..7a948b9a32 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/CountRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class CountRequestTest extends Assert { + + @Test + public void toBuilder() { + CountRequest origin = new CountRequest.Builder().index("index").build(); + CountRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/CreateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/CreateRequestTest.java new file mode 100644 index 0000000000..de11ae0687 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/CreateRequestTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class CreateRequestTest extends Assert { + + @Test + public void toBuilder() { + CreateRequest origin = new CreateRequest.Builder().id("id").document(new MyDoc("1")).index("index").build(); + CreateRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } + + static class MyDoc { + String key; + + MyDoc(String key) { + this.key = key; + } + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRequestTest.java index 3f2d402e29..2a546c6fad 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRequestTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRequestTest.java @@ -11,6 +11,9 @@ import java.util.Map; import org.junit.Assert; import org.junit.Test; +import org.opensearch.client.opensearch._types.FieldValue; +import org.opensearch.client.opensearch._types.query_dsl.Query; +import org.opensearch.client.opensearch._types.query_dsl.TermQuery; public class DeleteByQueryRequestTest extends Assert { @Test @@ -28,4 +31,20 @@ public void DeleteByQueryRequest() { assertTrue("Must have a slices query parameter", queryParameters.containsKey("slices")); assertEquals("6", queryParameters.get("slices")); } + + @Test + public void toBuilder() { + DeleteByQueryRequest origin = new DeleteByQueryRequest.Builder().index("index").query(buildDummyQuery()).build(); + DeleteByQueryRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } + + private Query buildDummyQuery() { + return Query.of( + query -> query.bool( + builder -> builder.filter(filter -> filter.term(TermQuery.of(term -> term.field("size").value(FieldValue.of(1))))) + ) + ); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequestTest.java new file mode 100644 index 0000000000..174045947f --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteByQueryRethrottleRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class DeleteByQueryRethrottleRequestTest extends Assert { + + @Test + public void toBuilder() { + DeleteByQueryRethrottleRequest origin = new DeleteByQueryRethrottleRequest.Builder().taskId("taskId").build(); + DeleteByQueryRethrottleRequest copied = origin.toBuilder().build(); + + assertEquals(copied.taskId(), origin.taskId()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteRequestTest.java new file mode 100644 index 0000000000..a80c166ba1 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class DeleteRequestTest extends Assert { + + @Test + public void toBuilder() { + DeleteRequest origin = new DeleteRequest.Builder().id("id").index("index").build(); + DeleteRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteScriptRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteScriptRequestTest.java new file mode 100644 index 0000000000..2e1a7fd653 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/DeleteScriptRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class DeleteScriptRequestTest extends Assert { + + @Test + public void toBuilder() { + DeleteScriptRequest origin = new DeleteScriptRequest.Builder().id("id").build(); + DeleteScriptRequest copied = origin.toBuilder().build(); + + assertEquals(copied.id(), origin.id()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsRequestTest.java new file mode 100644 index 0000000000..b0177acf62 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ExistsRequestTest extends Assert { + + @Test + public void toBuilder() { + ExistsRequest origin = new ExistsRequest.Builder().index("index").id("id").build(); + ExistsRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsSourceRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsSourceRequestTest.java new file mode 100644 index 0000000000..cc010a3228 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExistsSourceRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ExistsSourceRequestTest extends Assert { + + @Test + public void toBuilder() { + ExistsSourceRequest origin = new ExistsSourceRequest.Builder().index("index").id("id").build(); + ExistsSourceRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ExplainRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExplainRequestTest.java new file mode 100644 index 0000000000..cb716b13ea --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ExplainRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ExplainRequestTest extends Assert { + + @Test + public void toBuilder() { + ExplainRequest origin = new ExplainRequest.Builder().index("index").id("id").build(); + ExplainRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/FieldCapsRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/FieldCapsRequestTest.java new file mode 100644 index 0000000000..2c9a6c2738 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/FieldCapsRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class FieldCapsRequestTest extends Assert { + + @Test + public void toBuilder() { + FieldCapsRequest origin = new FieldCapsRequest.Builder().index("index").build(); + FieldCapsRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/GetRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetRequestTest.java new file mode 100644 index 0000000000..8fc224485a --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class GetRequestTest extends Assert { + + @Test + public void toBuilder() { + GetRequest origin = new GetRequest.Builder().index("index").id("id").build(); + GetRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/GetScriptRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetScriptRequestTest.java new file mode 100644 index 0000000000..416212fb4c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetScriptRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class GetScriptRequestTest extends Assert { + + @Test + public void toBuilder() { + GetScriptRequest origin = new GetScriptRequest.Builder().id("id").build(); + GetScriptRequest copied = origin.toBuilder().build(); + + assertEquals(copied.id(), origin.id()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/GetSourceRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetSourceRequestTest.java new file mode 100644 index 0000000000..9103f57067 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/GetSourceRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class GetSourceRequestTest extends Assert { + + @Test + public void toBuilder() { + GetSourceRequest origin = new GetSourceRequest.Builder().id("id").index("index").build(); + GetSourceRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/IndexRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/IndexRequestTest.java new file mode 100644 index 0000000000..fbfc09513d --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/IndexRequestTest.java @@ -0,0 +1,23 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class IndexRequestTest extends Assert { + + @Test + public void toBuilder() { + IndexRequest origin = new IndexRequest.Builder().id("id").index("index").document(new MyDoc("1")).build(); + IndexRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } + + static class MyDoc { + String key; + + MyDoc(String key) { + this.key = key; + } + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/MgetRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/MgetRequestTest.java new file mode 100644 index 0000000000..0fdeba65ec --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/MgetRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class MgetRequestTest extends Assert { + + @Test + public void toBuilder() { + MgetRequest origin = new MgetRequest.Builder().index("index").build(); + MgetRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchRequestTest.java new file mode 100644 index 0000000000..166a2e0e6c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchRequestTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch.core; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +public class MsearchRequestTest extends Assert { + + @Test + public void toBuilder() { + MsearchRequest origin = new MsearchRequest.Builder().index("index").searches(List.of()).build(); + MsearchRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchTemplateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchTemplateRequestTest.java new file mode 100644 index 0000000000..c741332568 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/MsearchTemplateRequestTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch.core; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +public class MsearchTemplateRequestTest extends Assert { + + @Test + public void toBuilder() { + MsearchTemplateRequest origin = new MsearchTemplateRequest.Builder().index("index").searchTemplates(List.of()).build(); + MsearchTemplateRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/MtermvectorsRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/MtermvectorsRequestTest.java new file mode 100644 index 0000000000..c8a11cecbe --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/MtermvectorsRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class MtermvectorsRequestTest extends Assert { + + @Test + public void toBuilder() { + MtermvectorsRequest origin = new MtermvectorsRequest.Builder().index("index").build(); + MtermvectorsRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/PutScriptRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/PutScriptRequestTest.java new file mode 100644 index 0000000000..7d7d3be80e --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/PutScriptRequestTest.java @@ -0,0 +1,18 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; +import org.opensearch.client.opensearch._types.StoredScript; + +public class PutScriptRequestTest extends Assert { + + @Test + public void toBuilder() { + PutScriptRequest origin = new PutScriptRequest.Builder().id("id") + .script(StoredScript.of(a -> a.lang("lang").source("source"))) + .build(); + PutScriptRequest copied = origin.toBuilder().build(); + + assertEquals(copied.id(), origin.id()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/RankEvalRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/RankEvalRequestTest.java new file mode 100644 index 0000000000..babf2a7aec --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/RankEvalRequestTest.java @@ -0,0 +1,16 @@ +package org.opensearch.client.opensearch.core; + +import java.util.List; +import org.junit.Assert; +import org.junit.Test; + +public class RankEvalRequestTest extends Assert { + + @Test + public void toBuilder() { + RankEvalRequest origin = new RankEvalRequest.Builder().index("index").requests(List.of()).build(); + RankEvalRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRequestTest.java index fdd8495b3a..1e4c5ea363 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRequestTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRequestTest.java @@ -28,4 +28,12 @@ public void testEndpointSlicesNumber() { assertTrue("Must have a slices query parameter", queryParameters.containsKey("slices")); assertEquals("6", queryParameters.get("slices")); } + + @Test + public void toBuilder() { + ReindexRequest origin = new ReindexRequest.Builder().requestsPerSecond(1L).build(); + ReindexRequest copied = origin.toBuilder().build(); + + assertEquals(copied.requestsPerSecond(), origin.requestsPerSecond()); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequestTest.java new file mode 100644 index 0000000000..c9c55b4a43 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ReindexRethrottleRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ReindexRethrottleRequestTest extends Assert { + + @Test + public void toBuilder() { + ReindexRethrottleRequest origin = new ReindexRethrottleRequest.Builder().taskId("taskId").build(); + ReindexRethrottleRequest copied = origin.toBuilder().build(); + + assertEquals(copied.taskId(), origin.taskId()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequestTest.java new file mode 100644 index 0000000000..db6eb1d6b8 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/RenderSearchTemplateRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class RenderSearchTemplateRequestTest extends Assert { + + @Test + public void toBuilder() { + RenderSearchTemplateRequest origin = new RenderSearchTemplateRequest.Builder().id("id").build(); + RenderSearchTemplateRequest copied = origin.toBuilder().build(); + + assertEquals(copied.id(), origin.id()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequestTest.java new file mode 100644 index 0000000000..773f40b0e0 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ScriptsPainlessExecuteRequestTest extends Assert { + + @Test + public void toBuilder() { + ScriptsPainlessExecuteRequest origin = new ScriptsPainlessExecuteRequest.Builder().context("context").build(); + ScriptsPainlessExecuteRequest copied = origin.toBuilder().build(); + + assertEquals(copied.context(), origin.context()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/ScrollRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/ScrollRequestTest.java new file mode 100644 index 0000000000..7419b9bb02 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/ScrollRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class ScrollRequestTest extends Assert { + + @Test + public void toBuilder() { + ScrollRequest origin = new ScrollRequest.Builder().scrollId("scrollId").build(); + ScrollRequest copied = origin.toBuilder().build(); + + assertEquals(copied.scrollId(), origin.scrollId()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java new file mode 100644 index 0000000000..165413ec59 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Test; +import org.opensearch.client.opensearch.model.ModelTestCase; + +public class SearchRequestTest extends ModelTestCase { + + @Test + public void toBuilder() { + SearchRequest origin = new SearchRequest.Builder().index("index").build(); + SearchRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchShardsRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchShardsRequestTest.java new file mode 100644 index 0000000000..15fd37568c --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchShardsRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class SearchShardsRequestTest extends Assert { + + @Test + public void toBuilder() { + SearchShardsRequest origin = new SearchShardsRequest.Builder().index("index").build(); + SearchShardsRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchTemplateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchTemplateRequestTest.java new file mode 100644 index 0000000000..72cccac4ab --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/SearchTemplateRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class SearchTemplateRequestTest extends Assert { + + @Test + public void toBuilder() { + SearchTemplateRequest origin = new SearchTemplateRequest.Builder().index("index").build(); + SearchTemplateRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/TermsEnumRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/TermsEnumRequestTest.java new file mode 100644 index 0000000000..8c64e7b577 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/TermsEnumRequestTest.java @@ -0,0 +1,15 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class TermsEnumRequestTest extends Assert { + + @Test + public void toBuilder() { + TermsEnumRequest origin = new TermsEnumRequest.Builder().index("index").field("field").build(); + TermsEnumRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/TermvectorsRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/TermvectorsRequestTest.java new file mode 100644 index 0000000000..7bae6e39c6 --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/TermvectorsRequestTest.java @@ -0,0 +1,17 @@ +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class TermvectorsRequestTest extends Assert { + + @Test + public void toBuilder() { + TermvectorsRequest origin = new TermvectorsRequest.Builder().index("index").build(); + TermvectorsRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } + + static class MyDoc {} +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRequestTest.java index f4148159b6..ffe3f3a7de 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRequestTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRequestTest.java @@ -28,4 +28,12 @@ public void testEndpointSlicesNumber() { assertTrue("Must have a slices query parameter", queryParameters.containsKey("slices")); assertEquals("6", queryParameters.get("slices")); } + + @Test + public void toBuilder() { + TermsEnumRequest origin = new TermsEnumRequest.Builder().index("index").field("field").build(); + TermsEnumRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequestTest.java new file mode 100644 index 0000000000..3f8db604fb --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateByQueryRethrottleRequestTest.java @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class UpdateByQueryRethrottleRequestTest extends Assert { + @Test + public void toBuilder() { + UpdateByQueryRethrottleRequest origin = new UpdateByQueryRethrottleRequest.Builder().taskId("taskId").build(); + UpdateByQueryRethrottleRequest copied = origin.toBuilder().build(); + + assertEquals(copied.taskId(), origin.taskId()); + } +} diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateRequestTest.java new file mode 100644 index 0000000000..832769818e --- /dev/null +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/UpdateRequestTest.java @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.opensearch.core; + +import org.junit.Assert; +import org.junit.Test; + +public class UpdateRequestTest extends Assert { + @Test + public void toBuilder() { + UpdateRequest origin = new UpdateRequest.Builder().index("index").id("id").build(); + UpdateRequest copied = origin.toBuilder().build(); + + assertEquals(copied.index(), origin.index()); + } +}