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 19582b652a..8127122be3 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 @@ -172,13 +172,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .filter(filter) - .minimumShouldMatch(minimumShouldMatch) - .must(must) - .mustNot(mustNot) - .should(should); + return toBuilder(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 e1fbd1d333..93bf82624c 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 @@ -111,7 +111,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).negativeBoost(negativeBoost).negative(negative).positive(positive); + return toBuilder(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 b23fd579b7..88a966ff2b 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 @@ -174,9 +174,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .fields(fields) + return toBuilder(new Builder()).fields(fields) .query(query) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .operator(operator) 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 c9f2fa459b..cb9bd377b9 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 @@ -183,9 +183,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .cutoffFrequency(cutoffFrequency) .highFreqOperator(highFreqOperator) 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 c7c8584bb0..544e9ade3b 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 @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).filter(filter); + return toBuilder(new Builder()).filter(filter); } // --------------------------------------------------------------------------------------------- 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 992a8e38ba..24cba1c8c5 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 @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).queries(queries).tieBreaker(tieBreaker); + return toBuilder(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 bbabab152f..3995f165d9 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 @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).origin(origin).pivot(pivot).field(field); + return toBuilder(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 dda35daf5e..a05229cab5 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 @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field); + return toBuilder(new Builder()).field(field); } // --------------------------------------------------------------------------------------------- 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 e29f6a5914..84f23d80e5 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 @@ -178,9 +178,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .boostMode(boostMode) + return toBuilder(new Builder()).boostMode(boostMode) .functions(functions) .maxBoost(maxBoost) .minScore(minScore) 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 2e35f8a47a..295ea1143b 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 @@ -186,9 +186,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .value(value) .maxExpansions(maxExpansions) .prefixLength(prefixLength) 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 166ef9b0b7..2525c26185 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 @@ -149,9 +149,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .boundingBox(boundingBox) .type(type) .validationMethod(validationMethod) 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 ce781186aa..2fc92cf470 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 @@ -147,7 +147,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).location(location); + return toBuilder(new Builder()).field(field).location(location); } // --------------------------------------------------------------------------------------------- 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 15a77d4d8b..daae1138b8 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 @@ -113,7 +113,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).shape(shape); + return toBuilder(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 c5314b0359..a89a2b19e7 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 @@ -184,9 +184,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .ignoreUnmapped(ignoreUnmapped) + return toBuilder(new Builder()).ignoreUnmapped(ignoreUnmapped) .innerHits(innerHits) .maxChildren(maxChildren) .minChildren(minChildren) 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 d3fa6d0bc4..755ad185b8 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 @@ -152,9 +152,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .ignoreUnmapped(ignoreUnmapped) + return toBuilder(new Builder()).ignoreUnmapped(ignoreUnmapped) .innerHits(innerHits) .parentType(parentType) .query(query) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java index 1e20cf9462..1f3048504a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/HybridQuery.java @@ -56,7 +56,7 @@ public Query.Kind _queryKind() { } public HybridQuery.Builder toBuilder() { - return new HybridQuery.Builder().queryName(queryName()).boost(boost()).queries(queries); + return toBuilder(new Builder()).queries(queries); } public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { 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 0799fb5519..74e9cb02d1 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 @@ -95,7 +95,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).values(values); + return toBuilder(new Builder()).values(values); } // --------------------------------------------------------------------------------------------- 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 d13b9e6523..1386e77ef7 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 @@ -252,7 +252,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost())._kind(_kind)._value(_value).field(field); + return toBuilder(new Builder())._kind(_kind)._value(_value).field(field); } public static class Builder extends QueryBase.AbstractBuilder implements ObjectBuilder { 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 89a02bf5ee..596752f47c 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 @@ -108,7 +108,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).vector(vector).k(k).filter(filter); + return toBuilder(new Builder()).field(field).vector(vector).k(k).filter(filter); } /** 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 ba2571a34c..fbd877201f 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 @@ -235,9 +235,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .fuzziness(fuzziness) .fuzzyRewrite(fuzzyRewrite) 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 2c568ba401..b275eb5a27 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 @@ -168,9 +168,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .maxExpansions(maxExpansions) .query(query) 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 953a0d31a2..c6c68dcd54 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 @@ -151,13 +151,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) - .analyzer(analyzer) - .query(query) - .slop(slop) - .zeroTermsQuery(zeroTermsQuery); + return toBuilder(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 346ad19d19..750c5d2948 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 @@ -307,9 +307,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .analyzer(analyzer) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .cutoffFrequency(cutoffFrequency) 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 4781ab1a74..18a28faa79 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 @@ -415,9 +415,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .boostTerms(boostTerms) .failOnUnsupportedField(failOnUnsupportedField) .fields(fields) 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 df54323426..fcab41899e 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 @@ -363,9 +363,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .cutoffFrequency(cutoffFrequency) .fields(fields) 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 5b091462cb..e3e6fc8e49 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 @@ -151,13 +151,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .ignoreUnmapped(ignoreUnmapped) - .innerHits(innerHits) - .path(path) - .query(query) - .scoreMode(scoreMode); + return toBuilder(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 f8ba7fe012..9984f912d0 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 @@ -152,14 +152,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) - .queryText(queryText) - .queryImage(queryImage) - .k(k) - .modelId(modelId) - .filter(filter); + return toBuilder(new Builder()).field(field).queryText(queryText).queryImage(queryImage).k(k).modelId(modelId).filter(filter); } /** 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 4cb32ce28c..7664f45ed1 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 @@ -124,7 +124,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).id(id).ignoreUnmapped(ignoreUnmapped).type(type); + return toBuilder(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 b1af736db0..b224ff47b6 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 @@ -228,9 +228,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .document(document) + return toBuilder(new Builder()).document(document) .documents(documents) .field(field) .id(id) 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 e96b0393cb..04a710c1c5 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 @@ -197,7 +197,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost())._kind(_kind)._value(_value).organic(organic); + return toBuilder(new Builder())._kind(_kind)._value(_value).organic(organic); } public static class Builder extends QueryBase.AbstractBuilder { 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 b921c33ed9..c7efcc35f3 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 @@ -135,13 +135,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) - .value(value) - .rewrite(rewrite) - .value(value) - .caseInsensitive(caseInsensitive); + return toBuilder(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/QueryBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java index b08abdbd6a..90b788fca2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/QueryBase.java @@ -98,6 +98,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + protected > BuilderT toBuilder(BuilderT builder) { + return builder.queryName(queryName).boost(boost); + } + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { @Nullable private Float boost; 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 275340f5ef..05e5c8165a 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 @@ -497,9 +497,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .allowLeadingWildcard(allowLeadingWildcard) + return toBuilder(new Builder()).allowLeadingWildcard(allowLeadingWildcard) .analyzer(analyzer) .analyzeWildcard(analyzeWildcard) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) 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 1ac2af8a6b..ec3dda228f 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 @@ -225,17 +225,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) - .gt(gt) - .gte(gte) - .lt(lt) - .lte(lte) - .from(from) - .to(to) - .format(format) - .timeZone(timeZone); + return toBuilder(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/RankFeatureQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/RankFeatureQuery.java index 2720a6581d..8614fb3082 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 @@ -155,13 +155,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) - .saturation(saturation) - .log(log) - .linear(linear) - .sigmoid(sigmoid); + return toBuilder(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 a4f086f4de..fdcef27d76 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 @@ -168,9 +168,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .value(value) .caseInsensitive(caseInsensitive) .flags(flags) 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 2c409f7a87..ec16228cd6 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 @@ -86,7 +86,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).script(script); + return toBuilder(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 c62acadb5d..6db3199f5f 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 @@ -117,7 +117,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).minScore(minScore).query(query).script(script); + return toBuilder(new Builder()).minScore(minScore).query(query).script(script); } // --------------------------------------------------------------------------------------------- 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 aee6201230..bb7c894fc0 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 @@ -294,9 +294,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .analyzer(analyzer) + return toBuilder(new Builder()).analyzer(analyzer) .analyzeWildcard(analyzeWildcard) .autoGenerateSynonymsPhraseQuery(autoGenerateSynonymsPhraseQuery) .defaultOperator(defaultOperator) 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 f7b3182802..130e867453 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 @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).big(big).little(little); + return toBuilder(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 e290e5050d..61db26c521 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 @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).query(query); + return toBuilder(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 37f41dcbc8..214712a6e7 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 @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).end(end).match(match); + return toBuilder(new Builder()).end(end).match(match); } // --------------------------------------------------------------------------------------------- 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 61b0e4f065..f29bfd9889 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 @@ -96,7 +96,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).match(match); + return toBuilder(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 c5ae19e8ac..4f87b7893d 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 @@ -137,7 +137,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).clauses(clauses).inOrder(inOrder).slop(slop); + return toBuilder(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 e386047019..13e3f36e66 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 @@ -159,7 +159,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).dist(dist).exclude(exclude).include(include).post(post).pre(pre); + return toBuilder(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 1dfa770976..ad3ae45559 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 @@ -102,7 +102,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).clauses(clauses); + return toBuilder(new Builder()).clauses(clauses); } // --------------------------------------------------------------------------------------------- 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 9949273bee..adfcf813ea 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 @@ -107,7 +107,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).value(value); + return toBuilder(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 7ac32054df..66a3df46ce 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 @@ -106,7 +106,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).big(big).little(little); + return toBuilder(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 71429e0c6e..a14ae01a10 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 @@ -119,7 +119,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).value(value).caseInsensitive(caseInsensitive); + return toBuilder(new Builder()).field(field).value(value).caseInsensitive(caseInsensitive); } // --------------------------------------------------------------------------------------------- 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 8b07686120..284e6e7c46 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 @@ -94,7 +94,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).field(field).terms(terms); + return toBuilder(new Builder()).field(field).terms(terms); } // --------------------------------------------------------------------------------------------- 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 f7de749940..1351aa9e5d 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 @@ -144,9 +144,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(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 9e3ea963b4..ac334bcdc2 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 @@ -85,7 +85,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).value(value); + return toBuilder(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 50e346bc72..d03d9cad3a 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 @@ -168,9 +168,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()) - .boost(boost()) - .field(field) + return toBuilder(new Builder()).field(field) .value(value) .caseInsensitive(caseInsensitive) .rewrite(rewrite) 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 fbe02bdc84..d4d7c2ecc2 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 @@ -88,7 +88,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public Builder toBuilder() { - return new Builder().queryName(queryName()).boost(boost()).query(query); + return toBuilder(new Builder()).query(query); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java index b3228db759..46d3bad07e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/query_dsl/XyShapeQuery.java @@ -112,7 +112,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } public XyShapeQuery.Builder toBuilder() { - return new XyShapeQuery.Builder().queryName(queryName()).boost(boost()).field(field).xyShape(xyShape); + return toBuilder(new Builder()).field(field).xyShape(xyShape); } // ---------------------------------------------------------------------------------------------