From df2acb3d9d81118e5dcf64979e0fa716beec8164 Mon Sep 17 00:00:00 2001 From: javanna Date: Fri, 30 Dec 2016 15:28:18 +0100 Subject: [PATCH] Remove some more usages of ParseFieldMatcher in favour of using ParseField directly Relates to #19552 Relates to #22130 --- .../common/xcontent/ParseFieldRegistry.java | 2 +- .../index/query/MoreLikeThisQueryBuilder.java | 12 +++--- .../index/query/QueryParseContext.java | 2 +- .../BlobStoreIndexShardSnapshot.java | 14 +++---- .../BlobStoreIndexShardSnapshots.java | 6 +-- .../admin/indices/RestAnalyzeAction.java | 18 ++++----- .../search/aggregations/Aggregator.java | 2 +- .../bucket/range/RangeAggregator.java | 10 ++--- .../GeoDistanceAggregationBuilder.java | 10 ++--- .../bucket/sampler/SamplerAggregator.java | 2 +- .../SignificantTermsAggregatorFactory.java | 2 +- .../bucket/terms/TermsAggregatorFactory.java | 2 +- .../bucket/terms/support/IncludeExclude.java | 6 +-- .../movavg/models/HoltWintersModel.java | 2 +- .../fetch/subphase/FetchSourceContext.java | 8 ++-- .../search/sort/GeoDistanceSortBuilder.java | 18 ++++----- .../search/suggest/SuggestBuilder.java | 2 +- .../phrase/PhraseSuggestionBuilder.java | 40 +++++++++---------- .../search/suggest/phrase/SmoothingModel.java | 6 +-- .../suggest/term/TermSuggestionBuilder.java | 28 ++++++------- .../suggest/CustomSuggesterSearchIT.java | 10 ++--- .../matrix/stats/MatrixStatsParser.java | 2 +- .../support/MultiValuesSourceParser.java | 10 ++--- .../reindex/RestUpdateByQueryAction.java | 4 +- 24 files changed, 109 insertions(+), 109 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/ParseFieldRegistry.java b/core/src/main/java/org/elasticsearch/common/xcontent/ParseFieldRegistry.java index 81f5b995c18..f0f2d759902 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/ParseFieldRegistry.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/ParseFieldRegistry.java @@ -103,7 +103,7 @@ public class ParseFieldRegistry { } ParseField parseField = parseFieldAndValue.v1(); T value = parseFieldAndValue.v2(); - boolean match = parseFieldMatcher.match(name, parseField); + boolean match = parseField.match(name); //this is always expected to match, ParseField is useful for deprecation warnings etc. here assert match : "ParseField did not match registered name [" + name + "][" + registryName + "]"; return value; diff --git a/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java index e4df758f2ba..1166a0d678d 100644 --- a/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java @@ -359,15 +359,15 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder fields = new ArrayList<>(); while (parser.nextToken() != XContentParser.Token.END_ARRAY) { @@ -378,7 +378,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder, To String currentFieldName = parser.currentName(); token = parser.nextToken(); if (token == XContentParser.Token.START_ARRAY) { - if (parseFieldMatcher.match(currentFieldName, ParseFields.FILES) == false) { + if (ParseFields.FILES.match(currentFieldName) == false) { throw new ElasticsearchParseException("unknown array [{}]", currentFieldName); } while (parser.nextToken() != XContentParser.Token.END_ARRAY) { @@ -253,7 +253,7 @@ public class BlobStoreIndexShardSnapshots implements Iterable, To files.put(fileInfo.name(), fileInfo); } } else if (token == XContentParser.Token.START_OBJECT) { - if (parseFieldMatcher.match(currentFieldName, ParseFields.SNAPSHOTS) == false) { + if (ParseFields.SNAPSHOTS.match(currentFieldName) == false) { throw new ElasticsearchParseException("unknown object [{}]", currentFieldName); } while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { @@ -268,7 +268,7 @@ public class BlobStoreIndexShardSnapshots implements Iterable, To if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); if (parser.nextToken() == XContentParser.Token.START_ARRAY) { - if (parseFieldMatcher.match(currentFieldName, ParseFields.FILES) == false) { + if (ParseFields.FILES.match(currentFieldName) == false) { throw new ElasticsearchParseException("unknown array [{}]", currentFieldName); } List fileNames = new ArrayList<>(); diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index c32010642e0..bbe022a318c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -83,9 +83,9 @@ public class RestAnalyzeAction extends BaseRestHandler { while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); - } else if (parseFieldMatcher.match(currentFieldName, Fields.TEXT) && token == XContentParser.Token.VALUE_STRING) { + } else if (Fields.TEXT.match(currentFieldName) && token == XContentParser.Token.VALUE_STRING) { analyzeRequest.text(parser.text()); - } else if (parseFieldMatcher.match(currentFieldName, Fields.TEXT) && token == XContentParser.Token.START_ARRAY) { + } else if (Fields.TEXT.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) { List texts = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token.isValue() == false) { @@ -94,11 +94,11 @@ public class RestAnalyzeAction extends BaseRestHandler { texts.add(parser.text()); } analyzeRequest.text(texts.toArray(new String[texts.size()])); - } else if (parseFieldMatcher.match(currentFieldName, Fields.ANALYZER) && token == XContentParser.Token.VALUE_STRING) { + } else if (Fields.ANALYZER.match(currentFieldName) && token == XContentParser.Token.VALUE_STRING) { analyzeRequest.analyzer(parser.text()); - } else if (parseFieldMatcher.match(currentFieldName, Fields.FIELD) && token == XContentParser.Token.VALUE_STRING) { + } else if (Fields.FIELD.match(currentFieldName) && token == XContentParser.Token.VALUE_STRING) { analyzeRequest.field(parser.text()); - } else if (parseFieldMatcher.match(currentFieldName, Fields.TOKENIZER)) { + } else if (Fields.TOKENIZER.match(currentFieldName)) { if (token == XContentParser.Token.VALUE_STRING) { analyzeRequest.tokenizer(parser.text()); } else if (token == XContentParser.Token.START_OBJECT) { @@ -106,7 +106,7 @@ public class RestAnalyzeAction extends BaseRestHandler { } else { throw new IllegalArgumentException(currentFieldName + " should be tokenizer's name or setting"); } - } else if (parseFieldMatcher.match(currentFieldName, Fields.TOKEN_FILTERS) + } else if (Fields.TOKEN_FILTERS.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -118,7 +118,7 @@ public class RestAnalyzeAction extends BaseRestHandler { + " array element should contain filter's name or setting"); } } - } else if (parseFieldMatcher.match(currentFieldName, Fields.CHAR_FILTERS) + } else if (Fields.CHAR_FILTERS.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -130,13 +130,13 @@ public class RestAnalyzeAction extends BaseRestHandler { + " array element should contain char filter's name or setting"); } } - } else if (parseFieldMatcher.match(currentFieldName, Fields.EXPLAIN)) { + } else if (Fields.EXPLAIN.match(currentFieldName)) { if (parser.isBooleanValue()) { analyzeRequest.explain(parser.booleanValue()); } else { throw new IllegalArgumentException(currentFieldName + " must be either 'true' or 'false'"); } - } else if (parseFieldMatcher.match(currentFieldName, Fields.ATTRIBUTES) && token == XContentParser.Token.START_ARRAY) { + } else if (Fields.ATTRIBUTES.match(currentFieldName) && token == XContentParser.Token.START_ARRAY) { List attributes = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token.isValue() == false) { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/Aggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/Aggregator.java index 37cfe18e83b..7c88f6373d8 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/Aggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/Aggregator.java @@ -132,7 +132,7 @@ public abstract class Aggregator extends BucketCollector implements Releasable { public static SubAggCollectionMode parse(String value, ParseFieldMatcher parseFieldMatcher) { SubAggCollectionMode[] modes = SubAggCollectionMode.values(); for (SubAggCollectionMode mode : modes) { - if (parseFieldMatcher.match(value, mode.parseField)) { + if (mode.parseField.match(value)) { return mode; } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java index cdb1dda221d..f526745322f 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/RangeAggregator.java @@ -134,17 +134,17 @@ public class RangeAggregator extends BucketsAggregator { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_NUMBER) { - if (parseFieldMatcher.match(currentFieldName, FROM_FIELD)) { + if (FROM_FIELD.match(currentFieldName)) { from = parser.doubleValue(); - } else if (parseFieldMatcher.match(currentFieldName, TO_FIELD)) { + } else if (TO_FIELD.match(currentFieldName)) { to = parser.doubleValue(); } } else if (token == XContentParser.Token.VALUE_STRING) { - if (parseFieldMatcher.match(currentFieldName, FROM_FIELD)) { + if (FROM_FIELD.match(currentFieldName)) { fromAsStr = parser.text(); - } else if (parseFieldMatcher.match(currentFieldName, TO_FIELD)) { + } else if (TO_FIELD.match(currentFieldName)) { toAsStr = parser.text(); - } else if (parseFieldMatcher.match(currentFieldName, KEY_FIELD)) { + } else if (KEY_FIELD.match(currentFieldName)) { key = parser.text(); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceAggregationBuilder.java index d70c150363b..85404dc178c 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceAggregationBuilder.java @@ -180,17 +180,17 @@ public class GeoDistanceAggregationBuilder extends ValuesSourceAggregationBuilde if (token == XContentParser.Token.FIELD_NAME) { toOrFromOrKey = parser.currentName(); } else if (token == XContentParser.Token.VALUE_NUMBER) { - if (parseFieldMatcher.match(toOrFromOrKey, Range.FROM_FIELD)) { + if (Range.FROM_FIELD.match(toOrFromOrKey)) { from = parser.doubleValue(); - } else if (parseFieldMatcher.match(toOrFromOrKey, Range.TO_FIELD)) { + } else if (Range.TO_FIELD.match(toOrFromOrKey)) { to = parser.doubleValue(); } } else if (token == XContentParser.Token.VALUE_STRING) { - if (parseFieldMatcher.match(toOrFromOrKey, Range.KEY_FIELD)) { + if (Range.KEY_FIELD.match(toOrFromOrKey)) { key = parser.text(); - } else if (parseFieldMatcher.match(toOrFromOrKey, Range.FROM_FIELD)) { + } else if (Range.FROM_FIELD.match(toOrFromOrKey)) { fromAsStr = parser.text(); - } else if (parseFieldMatcher.match(toOrFromOrKey, Range.TO_FIELD)) { + } else if (Range.TO_FIELD.match(toOrFromOrKey)) { toAsStr = parser.text(); } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java index 7d15839062c..1e8238d8de3 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregator.java @@ -113,7 +113,7 @@ public class SamplerAggregator extends SingleBucketAggregator { public static ExecutionMode fromString(String value, ParseFieldMatcher parseFieldMatcher) { for (ExecutionMode mode : values()) { - if (parseFieldMatcher.match(value, mode.parseField)) { + if (mode.parseField.match(value)) { return mode; } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java index 80e15394ede..009c49af54f 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java @@ -291,7 +291,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac public static ExecutionMode fromString(String value, ParseFieldMatcher parseFieldMatcher) { for (ExecutionMode mode : values()) { - if (parseFieldMatcher.match(value, mode.parseField)) { + if (mode.parseField.match(value)) { return mode; } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java index 37e6813ebcc..5a512eaeb4d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java @@ -308,7 +308,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory includesList = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -159,7 +159,7 @@ public class FetchSourceContext implements Writeable, ToXContent { } } includes = includesList.toArray(new String[includesList.size()]); - } else if (parseFieldMatcher.match(currentFieldName, EXCLUDES_FIELD)) { + } else if (EXCLUDES_FIELD.match(currentFieldName)) { List excludesList = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -175,9 +175,9 @@ public class FetchSourceContext implements Writeable, ToXContent { + " in [" + currentFieldName + "].", parser.getTokenLocation()); } } else if (token == XContentParser.Token.VALUE_STRING) { - if (parseFieldMatcher.match(currentFieldName, INCLUDES_FIELD)) { + if (INCLUDES_FIELD.match(currentFieldName)) { includes = new String[] {parser.text()}; - } else if (parseFieldMatcher.match(currentFieldName, EXCLUDES_FIELD)) { + } else if (EXCLUDES_FIELD.match(currentFieldName)) { excludes = new String[] {parser.text()}; } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token diff --git a/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java b/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java index 37e660d2a31..7111cee5766 100644 --- a/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java @@ -422,7 +422,7 @@ public class GeoDistanceSortBuilder extends SortBuilder fieldName = currentName; } else if (token == XContentParser.Token.START_OBJECT) { - if (parseFieldMatcher.match(currentName, NESTED_FILTER_FIELD)) { + if (NESTED_FILTER_FIELD.match(currentName)) { nestedFilter = context.parseInnerQueryBuilder(); } else { // the json in the format of -> field : { lat : 30, lon : 12 } @@ -439,27 +439,27 @@ public class GeoDistanceSortBuilder extends SortBuilder geoPoints.add(point); } } else if (token.isValue()) { - if (parseFieldMatcher.match(currentName, ORDER_FIELD)) { + if (ORDER_FIELD.match(currentName)) { order = SortOrder.fromString(parser.text()); - } else if (parseFieldMatcher.match(currentName, UNIT_FIELD)) { + } else if (UNIT_FIELD.match(currentName)) { unit = DistanceUnit.fromString(parser.text()); - } else if (parseFieldMatcher.match(currentName, DISTANCE_TYPE_FIELD)) { + } else if (DISTANCE_TYPE_FIELD.match(currentName)) { geoDistance = GeoDistance.fromString(parser.text()); - } else if (parseFieldMatcher.match(currentName, COERCE_FIELD)) { + } else if (COERCE_FIELD.match(currentName)) { coerce = parser.booleanValue(); if (coerce) { ignoreMalformed = true; } - } else if (parseFieldMatcher.match(currentName, IGNORE_MALFORMED_FIELD)) { + } else if (IGNORE_MALFORMED_FIELD.match(currentName)) { boolean ignore_malformed_value = parser.booleanValue(); if (coerce == false) { ignoreMalformed = ignore_malformed_value; } - } else if (parseFieldMatcher.match(currentName, VALIDATION_METHOD_FIELD)) { + } else if (VALIDATION_METHOD_FIELD.match(currentName)) { validation = GeoValidationMethod.fromString(parser.text()); - } else if (parseFieldMatcher.match(currentName, SORTMODE_FIELD)) { + } else if (SORTMODE_FIELD.match(currentName)) { sortMode = SortMode.fromString(parser.text()); - } else if (parseFieldMatcher.match(currentName, NESTED_PATH_FIELD)) { + } else if (NESTED_PATH_FIELD.match(currentName)) { nestedPath = parser.text(); } else if (token == Token.VALUE_STRING){ if (fieldName != null && fieldName.equals(currentName) == false) { diff --git a/core/src/main/java/org/elasticsearch/search/suggest/SuggestBuilder.java b/core/src/main/java/org/elasticsearch/search/suggest/SuggestBuilder.java index 332d18f256d..84c3da8618e 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/SuggestBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/SuggestBuilder.java @@ -154,7 +154,7 @@ public class SuggestBuilder extends ToXContentToBytes implements Writeable { if (token == XContentParser.Token.FIELD_NAME) { fieldName = parser.currentName(); } else if (token.isValue()) { - if (parseFieldMatcher.match(fieldName, GLOBAL_TEXT_FIELD)) { + if (GLOBAL_TEXT_FIELD.match(fieldName)) { suggestBuilder.setGlobalText(parser.text()); } else { throw new IllegalArgumentException("[suggest] does not support [" + fieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java index 969b1c24d5c..20d4f6853c0 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestionBuilder.java @@ -499,34 +499,34 @@ public class PhraseSuggestionBuilder extends SuggestionBuilder otherOptions) throws IOException { - if (parseFieldMatcher.match(currentFieldName, MULTIVALUE_MODE_FIELD)) { + if (MULTIVALUE_MODE_FIELD.match(currentFieldName)) { if (token == XContentParser.Token.VALUE_STRING) { otherOptions.put(MULTIVALUE_MODE_FIELD, parser.text()); return true; diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceParser.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceParser.java index 4311f975c1d..8d87d1fcd1c 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceParser.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/support/MultiValuesSourceParser.java @@ -93,11 +93,11 @@ public abstract class MultiValuesSourceParser implement if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (parseFieldMatcher.match(currentFieldName, CommonFields.FIELDS)) { + if (CommonFields.FIELDS.match(currentFieldName)) { fields = Collections.singletonList(parser.text()); - } else if (formattable && parseFieldMatcher.match(currentFieldName, CommonFields.FORMAT)) { + } else if (formattable && CommonFields.FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (parseFieldMatcher.match(currentFieldName, CommonFields.VALUE_TYPE)) { + } else if (CommonFields.VALUE_TYPE.match(currentFieldName)) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts."); @@ -106,7 +106,7 @@ public abstract class MultiValuesSourceParser implement "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } } else if (token == XContentParser.Token.START_OBJECT) { - if (parseFieldMatcher.match(currentFieldName, CommonFields.MISSING)) { + if (CommonFields.MISSING.match(currentFieldName)) { missingMap = new HashMap<>(); while (parser.nextToken() != XContentParser.Token.END_OBJECT) { parseMissingAndAdd(aggregationName, currentFieldName, parser, missingMap); @@ -125,7 +125,7 @@ public abstract class MultiValuesSourceParser implement throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts."); - } else if (parseFieldMatcher.match(currentFieldName, CommonFields.FIELDS)) { + } else if (CommonFields.FIELDS.match(currentFieldName)) { fields = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java index 8b197ebc21a..63640c84618 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestUpdateByQueryAction.java @@ -87,13 +87,13 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler entry = itr.next(); String parameterName = entry.getKey(); Object parameterValue = entry.getValue(); - if (parseFieldMatcher.match(parameterName, Script.LANG_PARSE_FIELD)) { + if (Script.LANG_PARSE_FIELD.match(parameterName)) { if (parameterValue instanceof String || parameterValue == null) { lang = (String) parameterValue; } else { throw new ElasticsearchParseException("Value must be of type String: [" + parameterName + "]"); } - } else if (parseFieldMatcher.match(parameterName, Script.PARAMS_PARSE_FIELD)) { + } else if (Script.PARAMS_PARSE_FIELD.match(parameterName)) { if (parameterValue instanceof Map || parameterValue == null) { params = (Map) parameterValue; } else {