diff --git a/server/src/main/java/org/opensearch/index/query/FuzzyQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/FuzzyQueryBuilder.java index b982f4d059ecd..3f4d3dd974967 100644 --- a/server/src/main/java/org/opensearch/index/query/FuzzyQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/FuzzyQueryBuilder.java @@ -81,7 +81,7 @@ public class FuzzyQueryBuilder extends AbstractQueryBuilder i private static final ParseField REWRITE_OVERRIDE = new ParseField("rewrite_override"); - private String rewrite_override; + private String rewriteOverride; private final String fieldName; @@ -186,8 +186,8 @@ public FuzzyQueryBuilder(StreamInput in) throws IOException { maxExpansions = in.readVInt(); transpositions = in.readBoolean(); rewrite = in.readOptionalString(); - if (in.getVersion().after(Version.V_2_16_0)) { - rewrite_override = in.readOptionalString(); + if (in.getVersion().onOrAfter(Version.V_2_17_0)) { + rewriteOverride = in.readOptionalString(); } } @@ -200,8 +200,8 @@ protected void doWriteTo(StreamOutput out) throws IOException { out.writeVInt(this.maxExpansions); out.writeBoolean(this.transpositions); out.writeOptionalString(this.rewrite); - if (out.getVersion().after(Version.V_2_16_0)) { - out.writeOptionalString(rewrite_override); + if (out.getVersion().onOrAfter(Version.V_2_17_0)) { + out.writeOptionalString(rewriteOverride); } } @@ -259,8 +259,8 @@ public String rewrite() { return this.rewrite; } - private FuzzyQueryBuilder rewrite_override(String rewrite_override) { - this.rewrite_override = rewrite_override; + private FuzzyQueryBuilder rewriteOverride(String rewriteOverride) { + this.rewriteOverride = rewriteOverride; return this; } @@ -277,8 +277,8 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); - if (rewrite_override != null) { - builder.field(REWRITE_OVERRIDE.getPreferredName(), rewrite_override); + if (rewriteOverride != null) { + builder.field(REWRITE_OVERRIDE.getPreferredName(), rewriteOverride); } builder.endObject(); builder.endObject(); @@ -292,7 +292,7 @@ public static FuzzyQueryBuilder fromXContent(XContentParser parser) throws IOExc int maxExpansions = FuzzyQueryBuilder.DEFAULT_MAX_EXPANSIONS; boolean transpositions = FuzzyQueryBuilder.DEFAULT_TRANSPOSITIONS; String rewrite = null; - String rewrite_override = null; + String rewriteOverride = null; String queryName = null; float boost = AbstractQueryBuilder.DEFAULT_BOOST; String currentFieldName = null; @@ -324,7 +324,7 @@ public static FuzzyQueryBuilder fromXContent(XContentParser parser) throws IOExc } else if (REWRITE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { rewrite = parser.textOrNull(); } else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) { - rewrite_override = parser.textOrNull(); + rewriteOverride = parser.textOrNull(); } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text(); } else { @@ -353,7 +353,7 @@ public static FuzzyQueryBuilder fromXContent(XContentParser parser) throws IOExc .rewrite(rewrite) .boost(boost) .queryName(queryName) - .rewrite_override(rewrite_override); + .rewriteOverride(rewriteOverride); } @Override @@ -380,12 +380,21 @@ protected Query doToQuery(QueryShardContext context) throws IOException { throw new IllegalStateException("Rewrite first"); } String rewrite = this.rewrite; - QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + QueryShardContext.RewriteOverride rewriteOverrideMethod = QueryParsers.parseRewriteOverride( + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); - Query query = fieldType.fuzzyQuery(value, fuzziness, prefixLength, maxExpansions, transpositions, null, rewriteOverride, context); + Query query = fieldType.fuzzyQuery( + value, + fuzziness, + prefixLength, + maxExpansions, + transpositions, + null, + rewriteOverrideMethod, + context + ); if (query instanceof MultiTermQuery) { MultiTermQuery.RewriteMethod rewriteMethod = QueryParsers.parseRewriteMethod(rewrite, null, LoggingDeprecationHandler.INSTANCE); query = fieldType.fuzzyQuery( @@ -395,7 +404,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException { maxExpansions, transpositions, rewriteMethod, - rewriteOverride, + rewriteOverrideMethod, context ); } @@ -404,7 +413,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException { @Override protected int doHashCode() { - return Objects.hash(fieldName, value, fuzziness, prefixLength, maxExpansions, transpositions, rewrite, rewrite_override); + return Objects.hash(fieldName, value, fuzziness, prefixLength, maxExpansions, transpositions, rewrite, rewriteOverride); } @Override @@ -416,6 +425,6 @@ protected boolean doEquals(FuzzyQueryBuilder other) { && Objects.equals(maxExpansions, other.maxExpansions) && Objects.equals(transpositions, other.transpositions) && Objects.equals(rewrite, other.rewrite) - && Objects.equals(rewrite_override, other.rewrite_override); + && Objects.equals(rewriteOverride, other.rewriteOverride); } } diff --git a/server/src/main/java/org/opensearch/index/query/PrefixQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/PrefixQueryBuilder.java index 1b1cb179368b7..6e5963ad63034 100644 --- a/server/src/main/java/org/opensearch/index/query/PrefixQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/PrefixQueryBuilder.java @@ -65,7 +65,7 @@ public class PrefixQueryBuilder extends AbstractQueryBuilder private static final ParseField REWRITE_OVERRIDE = new ParseField("rewrite_override"); - private String rewrite_override; + private String rewriteOverride; private final String fieldName; @@ -103,8 +103,8 @@ public PrefixQueryBuilder(StreamInput in) throws IOException { value = in.readString(); rewrite = in.readOptionalString(); caseInsensitive = in.readBoolean(); - if (in.getVersion().after(Version.V_2_16_0)) { - rewrite_override = in.readOptionalString(); + if (in.getVersion().onOrAfter(Version.V_2_17_0)) { + rewriteOverride = in.readOptionalString(); } } @@ -114,8 +114,8 @@ protected void doWriteTo(StreamOutput out) throws IOException { out.writeString(value); out.writeOptionalString(rewrite); out.writeBoolean(caseInsensitive); - if (out.getVersion().after(Version.V_2_16_0)) { - out.writeOptionalString(rewrite_override); + if (out.getVersion().onOrAfter(Version.V_2_17_0)) { + out.writeOptionalString(rewriteOverride); } } @@ -142,8 +142,8 @@ public PrefixQueryBuilder rewrite(String rewrite) { return this; } - public PrefixQueryBuilder rewrite_override(String rewrite_override) { - this.rewrite_override = rewrite_override; + public PrefixQueryBuilder rewriteOverride(String rewriteOverride) { + this.rewriteOverride = rewriteOverride; return this; } @@ -163,8 +163,8 @@ public void doXContent(XContentBuilder builder, Params params) throws IOExceptio builder.field(CASE_INSENSITIVE_FIELD.getPreferredName(), caseInsensitive); } printBoostAndQueryName(builder); - if (rewrite_override != null) { - builder.field(REWRITE_OVERRIDE.getPreferredName(), rewrite_override); + if (rewriteOverride != null) { + builder.field(REWRITE_OVERRIDE.getPreferredName(), rewriteOverride); } builder.endObject(); builder.endObject(); @@ -174,7 +174,7 @@ public static PrefixQueryBuilder fromXContent(XContentParser parser) throws IOEx String fieldName = null; String value = null; String rewrite = null; - String rewrite_override = null; + String rewriteOverride = null; String queryName = null; float boost = AbstractQueryBuilder.DEFAULT_BOOST; @@ -202,7 +202,7 @@ public static PrefixQueryBuilder fromXContent(XContentParser parser) throws IOEx } else if (CASE_INSENSITIVE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { caseInsensitive = parser.booleanValue(); } else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) { - rewrite_override = parser.textOrNull(); + rewriteOverride = parser.textOrNull(); } else { throw new ParsingException( parser.getTokenLocation(), @@ -222,7 +222,7 @@ public static PrefixQueryBuilder fromXContent(XContentParser parser) throws IOEx .boost(boost) .queryName(queryName) .caseInsensitive(caseInsensitive) - .rewrite_override(rewrite_override); + .rewriteOverride(rewriteOverride); } @Override @@ -242,7 +242,7 @@ protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) throws // fields we also have the guarantee that it doesn't perform I/O, which is important // since rewrites might happen on a network thread. QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); @@ -269,17 +269,17 @@ protected Query doToQuery(QueryShardContext context) throws IOException { if (fieldType == null) { throw new IllegalStateException("Rewrite first"); } - QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + QueryShardContext.RewriteOverride rewriteOverrideMethod = QueryParsers.parseRewriteOverride( + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); - return fieldType.prefixQuery(value, method, rewriteOverride, caseInsensitive, context); + return fieldType.prefixQuery(value, method, rewriteOverrideMethod, caseInsensitive, context); } @Override protected final int doHashCode() { - return Objects.hash(fieldName, value, rewrite, caseInsensitive, rewrite_override); + return Objects.hash(fieldName, value, rewrite, caseInsensitive, rewriteOverride); } @Override @@ -287,7 +287,7 @@ protected boolean doEquals(PrefixQueryBuilder other) { return Objects.equals(fieldName, other.fieldName) && Objects.equals(value, other.value) && Objects.equals(rewrite, other.rewrite) - && Objects.equals(rewrite_override, other.rewrite_override) + && Objects.equals(rewriteOverride, other.rewriteOverride) && Objects.equals(caseInsensitive, other.caseInsensitive); } } diff --git a/server/src/main/java/org/opensearch/index/query/RangeQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/RangeQueryBuilder.java index c07319c9f49ea..7973c0eef97c5 100644 --- a/server/src/main/java/org/opensearch/index/query/RangeQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/RangeQueryBuilder.java @@ -89,7 +89,7 @@ public class RangeQueryBuilder extends AbstractQueryBuilder i private String format; private ShapeRelation relation; - private String rewrite_override; + private String rewriteOverride; /** * A Query that matches documents within an range of terms. @@ -122,8 +122,8 @@ public RangeQueryBuilder(StreamInput in) throws IOException { throw new IllegalArgumentException("[range] query does not support relation [" + relationString + "]"); } } - if (in.getVersion().after(Version.V_2_16_0)) { - rewrite_override = in.readOptionalString(); + if (in.getVersion().after(Version.V_2_17_0)) { + rewriteOverride = in.readOptionalString(); } } @@ -145,8 +145,8 @@ protected void doWriteTo(StreamOutput out) throws IOException { relationString = this.relation.getRelationName(); } out.writeOptionalString(relationString); - if (out.getVersion().after(Version.V_2_16_0)) { - out.writeOptionalString(rewrite_override); + if (out.getVersion().after(Version.V_2_17_0)) { + out.writeOptionalString(rewriteOverride); } } @@ -283,8 +283,8 @@ public RangeQueryBuilder timeZone(String timeZone) { return this; } - public RangeQueryBuilder rewrite_override(String rewrite_override) { - this.rewrite_override = rewrite_override; + public RangeQueryBuilder rewriteOverride(String rewriteOverride) { + this.rewriteOverride = rewriteOverride; return this; } @@ -362,8 +362,8 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep builder.field(RELATION_FIELD.getPreferredName(), relation.getRelationName()); } printBoostAndQueryName(builder); - if (rewrite_override != null) { - builder.field(REWRITE_OVERRIDE.getPreferredName(), rewrite_override); + if (rewriteOverride != null) { + builder.field(REWRITE_OVERRIDE.getPreferredName(), rewriteOverride); } builder.endObject(); builder.endObject(); @@ -380,7 +380,7 @@ public static RangeQueryBuilder fromXContent(XContentParser parser) throws IOExc String queryName = null; String format = null; String relation = null; - String rewrite_override = null; + String rewriteOverride = null; String currentFieldName = null; XContentParser.Token token; @@ -425,7 +425,7 @@ public static RangeQueryBuilder fromXContent(XContentParser parser) throws IOExc } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text(); } else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) { - rewrite_override = parser.textOrNull(); + rewriteOverride = parser.textOrNull(); } else { throw new ParsingException( parser.getTokenLocation(), @@ -455,7 +455,7 @@ public static RangeQueryBuilder fromXContent(XContentParser parser) throws IOExc if (relation != null) { rangeQuery.relation(relation); } - rangeQuery.rewrite_override(rewrite_override); + rangeQuery.rewriteOverride(rewriteOverride); return rangeQuery; } @@ -548,17 +548,27 @@ protected Query doToQuery(QueryShardContext context) throws IOException { throw new IllegalStateException("Rewrite first"); } DateMathParser forcedDateParser = getForceDateParser(); - QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + QueryShardContext.RewriteOverride rewriteOverrideMethod = QueryParsers.parseRewriteOverride( + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); - return mapper.rangeQuery(from, to, includeLower, includeUpper, relation, timeZone, forcedDateParser, rewriteOverride, context); + return mapper.rangeQuery( + from, + to, + includeLower, + includeUpper, + relation, + timeZone, + forcedDateParser, + rewriteOverrideMethod, + context + ); } @Override protected int doHashCode() { - return Objects.hash(fieldName, from, to, timeZone, includeLower, includeUpper, format, rewrite_override); + return Objects.hash(fieldName, from, to, timeZone, includeLower, includeUpper, format, rewriteOverride); } @Override @@ -570,6 +580,6 @@ protected boolean doEquals(RangeQueryBuilder other) { && Objects.equals(includeLower, other.includeLower) && Objects.equals(includeUpper, other.includeUpper) && Objects.equals(format, other.format) - && Objects.equals(rewrite_override, other.rewrite_override); + && Objects.equals(rewriteOverride, other.rewriteOverride); } } diff --git a/server/src/main/java/org/opensearch/index/query/RegexpQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/RegexpQueryBuilder.java index c2ddb622d631a..01fe387e00196 100644 --- a/server/src/main/java/org/opensearch/index/query/RegexpQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/RegexpQueryBuilder.java @@ -76,7 +76,7 @@ public class RegexpQueryBuilder extends AbstractQueryBuilder private static final ParseField REWRITE_OVERRIDE = new ParseField("rewrite_override"); - private String rewrite_override; + private String rewriteOverride; private final String fieldName; @@ -117,8 +117,8 @@ public RegexpQueryBuilder(StreamInput in) throws IOException { maxDeterminizedStates = in.readVInt(); rewrite = in.readOptionalString(); caseInsensitive = in.readBoolean(); - if (in.getVersion().after(Version.V_2_16_0)) { - rewrite_override = in.readOptionalString(); + if (in.getVersion().after(Version.V_2_17_0)) { + rewriteOverride = in.readOptionalString(); } } @@ -130,8 +130,8 @@ protected void doWriteTo(StreamOutput out) throws IOException { out.writeVInt(maxDeterminizedStates); out.writeOptionalString(rewrite); out.writeBoolean(caseInsensitive); - if (out.getVersion().after(Version.V_2_16_0)) { - out.writeOptionalString(rewrite_override); + if (out.getVersion().after(Version.V_2_17_0)) { + out.writeOptionalString(rewriteOverride); } } @@ -183,8 +183,8 @@ public boolean caseInsensitive() { return this.caseInsensitive; } - public RegexpQueryBuilder rewrite_override(String rewrite_override) { - this.rewrite_override = rewrite_override; + public RegexpQueryBuilder rewriteOverride(String rewriteOverride) { + this.rewriteOverride = rewriteOverride; return this; } @@ -223,8 +223,8 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep builder.field(REWRITE_FIELD.getPreferredName(), rewrite); } printBoostAndQueryName(builder); - if (rewrite_override != null) { - builder.field(REWRITE_OVERRIDE.getPreferredName(), rewrite_override); + if (rewriteOverride != null) { + builder.field(REWRITE_OVERRIDE.getPreferredName(), rewriteOverride); } builder.endObject(); builder.endObject(); @@ -234,7 +234,7 @@ public static RegexpQueryBuilder fromXContent(XContentParser parser) throws IOEx String fieldName = null; String rewrite = null; String value = null; - String rewrite_override = null; + String rewriteOverride = null; float boost = AbstractQueryBuilder.DEFAULT_BOOST; int flagsValue = RegexpQueryBuilder.DEFAULT_FLAGS_VALUE; boolean caseInsensitive = DEFAULT_CASE_INSENSITIVITY; @@ -270,7 +270,7 @@ public static RegexpQueryBuilder fromXContent(XContentParser parser) throws IOEx } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text(); } else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) { - rewrite_override = parser.textOrNull(); + rewriteOverride = parser.textOrNull(); } else { throw new ParsingException( parser.getTokenLocation(), @@ -292,7 +292,7 @@ public static RegexpQueryBuilder fromXContent(XContentParser parser) throws IOEx .boost(boost) .queryName(queryName); result.caseInsensitive(caseInsensitive); - result.rewrite_override(rewrite_override); + result.rewriteOverride(rewriteOverride); return result; } @@ -326,8 +326,8 @@ protected Query doToQuery(QueryShardContext context) throws QueryShardException, MappedFieldType fieldType = context.fieldMapper(fieldName); if (fieldType != null) { - QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + QueryShardContext.RewriteOverride rewriteOverrideMethod = QueryParsers.parseRewriteOverride( + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); @@ -337,7 +337,7 @@ protected Query doToQuery(QueryShardContext context) throws QueryShardException, matchFlagsValue, maxDeterminizedStates, method, - rewriteOverride, + rewriteOverrideMethod, context ); } @@ -359,7 +359,7 @@ protected Query doToQuery(QueryShardContext context) throws QueryShardException, @Override protected int doHashCode() { - return Objects.hash(fieldName, value, syntaxFlagsValue, caseInsensitive, maxDeterminizedStates, rewrite, rewrite_override); + return Objects.hash(fieldName, value, syntaxFlagsValue, caseInsensitive, maxDeterminizedStates, rewrite, rewriteOverride); } @Override @@ -370,6 +370,6 @@ protected boolean doEquals(RegexpQueryBuilder other) { && Objects.equals(caseInsensitive, other.caseInsensitive) && Objects.equals(maxDeterminizedStates, other.maxDeterminizedStates) && Objects.equals(rewrite, other.rewrite) - && Objects.equals(rewrite_override, other.rewrite_override); + && Objects.equals(rewriteOverride, other.rewriteOverride); } } diff --git a/server/src/main/java/org/opensearch/index/query/TermsQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/TermsQueryBuilder.java index ac09420c623f3..f08a84e7d58e2 100644 --- a/server/src/main/java/org/opensearch/index/query/TermsQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/TermsQueryBuilder.java @@ -88,7 +88,7 @@ public class TermsQueryBuilder extends AbstractQueryBuilder { private static final ParseField REWRITE_OVERRIDE = new ParseField("rewrite_override"); - private String rewrite_override; + private String rewriteOverride; public TermsQueryBuilder(String fieldName, TermsLookup termsLookup) { this(fieldName, null, termsLookup); @@ -202,14 +202,14 @@ private TermsQueryBuilder(String fieldName, Supplier> supplier) { this.supplier = supplier; } - private TermsQueryBuilder(String fieldName, Iterable values, String rewrite_override) { + private TermsQueryBuilder(String fieldName, Iterable values, String rewriteOverride) { this(fieldName, values); - this.rewrite_override = rewrite_override; + this.rewriteOverride = rewriteOverride; } - private TermsQueryBuilder(String fieldName, Supplier> supplier, String rewrite_override) { + private TermsQueryBuilder(String fieldName, Supplier> supplier, String rewriteOverride) { this(fieldName, supplier); - this.rewrite_override = rewrite_override; + this.rewriteOverride = rewriteOverride; } /** @@ -221,8 +221,8 @@ public TermsQueryBuilder(StreamInput in) throws IOException { termsLookup = in.readOptionalWriteable(TermsLookup::new); values = (List) in.readGenericValue(); this.supplier = null; - if (in.getVersion().after(Version.V_2_16_0)) { - rewrite_override = in.readOptionalString(); + if (in.getVersion().after(Version.V_2_17_0)) { + rewriteOverride = in.readOptionalString(); } } @@ -234,8 +234,8 @@ protected void doWriteTo(StreamOutput out) throws IOException { out.writeString(fieldName); out.writeOptionalWriteable(termsLookup); out.writeGenericValue(values); - if (out.getVersion().after(Version.V_2_16_0)) { - out.writeOptionalString(rewrite_override); + if (out.getVersion().after(Version.V_2_17_0)) { + out.writeOptionalString(rewriteOverride); } } @@ -251,8 +251,8 @@ public TermsLookup termsLookup() { return this.termsLookup; } - public TermsQueryBuilder rewrite_override(String rewrite_override) { - this.rewrite_override = rewrite_override; + public TermsQueryBuilder rewriteOverride(String rewriteOverride) { + this.rewriteOverride = rewriteOverride; return this; } @@ -389,8 +389,8 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep builder.field(fieldName, convertBack(values)); } printBoostAndQueryName(builder); - if (rewrite_override != null) { - builder.field(REWRITE_OVERRIDE.getPreferredName(), rewrite_override); + if (rewriteOverride != null) { + builder.field(REWRITE_OVERRIDE.getPreferredName(), rewriteOverride); } builder.endObject(); } @@ -400,7 +400,7 @@ public static TermsQueryBuilder fromXContent(XContentParser parser) throws IOExc List values = null; TermsLookup termsLookup = null; - String rewrite_override = null; + String rewriteOverride = null; String queryName = null; float boost = AbstractQueryBuilder.DEFAULT_BOOST; @@ -441,7 +441,7 @@ public static TermsQueryBuilder fromXContent(XContentParser parser) throws IOExc } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { queryName = parser.text(); } else if (REWRITE_OVERRIDE.match(currentFieldName, parser.getDeprecationHandler())) { - rewrite_override = parser.textOrNull(); + rewriteOverride = parser.textOrNull(); } else { throw new ParsingException( parser.getTokenLocation(), @@ -466,7 +466,7 @@ public static TermsQueryBuilder fromXContent(XContentParser parser) throws IOExc ); } - return new TermsQueryBuilder(fieldName, values, termsLookup).boost(boost).queryName(queryName).rewrite_override(rewrite_override); + return new TermsQueryBuilder(fieldName, values, termsLookup).boost(boost).queryName(queryName).rewriteOverride(rewriteOverride); } static List parseValues(XContentParser parser) throws IOException { @@ -509,12 +509,12 @@ protected Query doToQuery(QueryShardContext context) throws IOException { if (fieldType == null) { throw new IllegalStateException("Rewrite first"); } - QueryShardContext.RewriteOverride rewriteOverride = QueryParsers.parseRewriteOverride( - rewrite_override, + QueryShardContext.RewriteOverride rewriteOverrideMethod = QueryParsers.parseRewriteOverride( + rewriteOverride, QueryShardContext.RewriteOverride.INDEX_OR_DOC_VALUES, LoggingDeprecationHandler.INSTANCE ); - return fieldType.termsQuery(values, rewriteOverride, context); + return fieldType.termsQuery(values, rewriteOverrideMethod, context); } private void fetch(TermsLookup termsLookup, Client client, ActionListener> actionListener) { @@ -532,7 +532,7 @@ private void fetch(TermsLookup termsLookup, Client client, ActionListener> supplier = new SetOnce<>(); queryRewriteContext.registerAsyncAction((client, listener) -> fetch(termsLookup, client, ActionListener.map(listener, list -> { supplier.set(list); return null; }))); - return new TermsQueryBuilder(this.fieldName, supplier::get, rewrite_override); + return new TermsQueryBuilder(this.fieldName, supplier::get, rewriteOverride); } if (values == null || values.isEmpty()) { diff --git a/server/src/main/java/org/opensearch/index/query/WildcardQueryBuilder.java b/server/src/main/java/org/opensearch/index/query/WildcardQueryBuilder.java index 733111398cc70..0b376507b8f13 100644 --- a/server/src/main/java/org/opensearch/index/query/WildcardQueryBuilder.java +++ b/server/src/main/java/org/opensearch/index/query/WildcardQueryBuilder.java @@ -70,7 +70,7 @@ public class WildcardQueryBuilder extends AbstractQueryBuilder