diff --git a/core/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java b/core/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java index 2c8b9af28d6a8..5a767ecc3a0ba 100644 --- a/core/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java +++ b/core/src/main/java/org/elasticsearch/index/query/functionscore/DecayFunctionParser.java @@ -112,7 +112,7 @@ public DFB fromXContent(QueryParseContext context) throws IOException, ParsingEx XContentBuilder builder = XContentFactory.jsonBuilder(); builder.copyCurrentStructure(parser); functionBytes = builder.bytes(); - } else if (context.getParseFieldMatcher().match(currentFieldName, MULTI_VALUE_MODE)) { + } else if (MULTI_VALUE_MODE.match(currentFieldName)) { multiValueMode = MultiValueMode.fromString(parser.text()); } else { throw new ParsingException(parser.getTokenLocation(), "malformed score function score parameters."); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregationBuilder.java index 10bbc03dd46ad..b970d80902053 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregationBuilder.java @@ -217,21 +217,21 @@ public static FiltersAggregationBuilder parse(String aggregationName, QueryParse if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_BOOLEAN) { - if (context.getParseFieldMatcher().match(currentFieldName, OTHER_BUCKET_FIELD)) { + if (OTHER_BUCKET_FIELD.match(currentFieldName)) { otherBucket = parser.booleanValue(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, OTHER_BUCKET_KEY_FIELD)) { + if (OTHER_BUCKET_KEY_FIELD.match(currentFieldName)) { otherBucketKey = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, FILTERS_FIELD)) { + if (FILTERS_FIELD.match(currentFieldName)) { keyedFilters = new ArrayList<>(); String key = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { @@ -247,7 +247,7 @@ public static FiltersAggregationBuilder parse(String aggregationName, QueryParse "Unknown key for a " + token + " in [" + aggregationName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, FILTERS_FIELD)) { + if (FILTERS_FIELD.match(currentFieldName)) { nonKeyedFilters = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { QueryBuilder filter = context.parseInnerQueryBuilder(); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java index dbb08e792adf5..1e70da265a7e9 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/nested/NestedAggregationBuilder.java @@ -116,7 +116,7 @@ public static NestedAggregationBuilder parse(String aggregationName, QueryParseC if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, NestedAggregator.PATH_FIELD)) { + if (NestedAggregator.PATH_FIELD.match(currentFieldName)) { path = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregationBuilder.java index 46353ad371ecb..ffca6e5b096e7 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/sampler/SamplerAggregationBuilder.java @@ -98,7 +98,7 @@ public static SamplerAggregationBuilder parse(String aggregationName, QueryParse if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_NUMBER) { - if (context.getParseFieldMatcher().match(currentFieldName, SamplerAggregator.SHARD_SIZE_FIELD)) { + if (SamplerAggregator.SHARD_SIZE_FIELD.match(currentFieldName)) { shardSize = parser.intValue(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java index b5ee7e09ee55b..b49ca9fe1c9de 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java @@ -157,7 +157,7 @@ public static SignificanceHeuristic parse(QueryParseContext context) if (token.equals(XContentParser.Token.FIELD_NAME)) { currentFieldName = parser.currentName(); } else { - if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else { throw new ElasticsearchParseException("failed to parse [{}] significance heuristic. unknown object [{}]", heuristicName, currentFieldName); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregationBuilder.java index e778a9cd36955..6b4d1bc1b8f49 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/scripted/ScriptedMetricAggregationBuilder.java @@ -254,16 +254,16 @@ public static ScriptedMetricAggregationBuilder parse(String aggregationName, Que if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT || token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, INIT_SCRIPT_FIELD)) { + if (INIT_SCRIPT_FIELD.match(currentFieldName)) { initScript = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, MAP_SCRIPT_FIELD)) { + } else if (MAP_SCRIPT_FIELD.match(currentFieldName)) { mapScript = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, COMBINE_SCRIPT_FIELD)) { + } else if (COMBINE_SCRIPT_FIELD.match(currentFieldName)) { combineScript = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, REDUCE_SCRIPT_FIELD)) { + } else if (REDUCE_SCRIPT_FIELD.match(currentFieldName)) { reduceScript = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else if (token == XContentParser.Token.START_OBJECT && - context.getParseFieldMatcher().match(currentFieldName, PARAMS_FIELD)) { + PARAMS_FIELD.match(currentFieldName)) { params = parser.map(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java index d63ca8656746c..33da060ba7ddf 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/tophits/TopHitsAggregationBuilder.java @@ -605,31 +605,31 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.FROM_FIELD)) { + if (SearchSourceBuilder.FROM_FIELD.match(currentFieldName)) { factory.from(parser.intValue()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SIZE_FIELD)) { + } else if (SearchSourceBuilder.SIZE_FIELD.match(currentFieldName)) { factory.size(parser.intValue()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.VERSION_FIELD)) { + } else if (SearchSourceBuilder.VERSION_FIELD.match(currentFieldName)) { factory.version(parser.booleanValue()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.EXPLAIN_FIELD)) { + } else if (SearchSourceBuilder.EXPLAIN_FIELD.match(currentFieldName)) { factory.explain(parser.booleanValue()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.TRACK_SCORES_FIELD)) { + } else if (SearchSourceBuilder.TRACK_SCORES_FIELD.match(currentFieldName)) { factory.trackScores(parser.booleanValue()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder._SOURCE_FIELD)) { + } else if (SearchSourceBuilder._SOURCE_FIELD.match(currentFieldName)) { factory.fetchSource(FetchSourceContext.parse(context.parser())); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.STORED_FIELDS_FIELD)) { + } else if (SearchSourceBuilder.STORED_FIELDS_FIELD.match(currentFieldName)) { factory.storedFieldsContext = StoredFieldsContext.fromXContent(SearchSourceBuilder.STORED_FIELDS_FIELD.getPreferredName(), context); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SORT_FIELD)) { + } else if (SearchSourceBuilder.SORT_FIELD.match(currentFieldName)) { factory.sort(parser.text()); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].", parser.getTokenLocation()); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder._SOURCE_FIELD)) { + if (SearchSourceBuilder._SOURCE_FIELD.match(currentFieldName)) { factory.fetchSource(FetchSourceContext.parse(context.parser())); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SCRIPT_FIELDS_FIELD)) { + } else if (SearchSourceBuilder.SCRIPT_FIELDS_FIELD.match(currentFieldName)) { List scriptFields = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { String scriptFieldName = parser.currentName(); @@ -641,7 +641,7 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SCRIPT_FIELD)) { + if (SearchSourceBuilder.SCRIPT_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.IGNORE_FAILURE_FIELD)) { @@ -652,7 +652,7 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse parser.getTokenLocation()); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SCRIPT_FIELD)) { + if (SearchSourceBuilder.SCRIPT_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), @@ -671,9 +671,9 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse } } factory.scriptFields(scriptFields); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.HIGHLIGHT_FIELD)) { + } else if (SearchSourceBuilder.HIGHLIGHT_FIELD.match(currentFieldName)) { factory.highlighter(HighlightBuilder.fromXContent(context)); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SORT_FIELD)) { + } else if (SearchSourceBuilder.SORT_FIELD.match(currentFieldName)) { List> sorts = SortBuilder.fromXContent(context); factory.sorts(sorts); } else { @@ -682,10 +682,10 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.STORED_FIELDS_FIELD)) { + if (SearchSourceBuilder.STORED_FIELDS_FIELD.match(currentFieldName)) { factory.storedFieldsContext = StoredFieldsContext.fromXContent(SearchSourceBuilder.STORED_FIELDS_FIELD.getPreferredName(), context); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.DOCVALUE_FIELDS_FIELD)) { + } else if (SearchSourceBuilder.DOCVALUE_FIELDS_FIELD.match(currentFieldName)) { List fieldDataFields = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -696,10 +696,10 @@ public static TopHitsAggregationBuilder parse(String aggregationName, QueryParse } } factory.fieldDataFields(fieldDataFields); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder.SORT_FIELD)) { + } else if (SearchSourceBuilder.SORT_FIELD.match(currentFieldName)) { List> sorts = SortBuilder.fromXContent(context); factory.sorts(sorts); - } else if (context.getParseFieldMatcher().match(currentFieldName, SearchSourceBuilder._SOURCE_FIELD)) { + } else if (SearchSourceBuilder._SOURCE_FIELD.match(currentFieldName)) { factory.fetchSource(FetchSourceContext.parse(context.parser())); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].", diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketHelpers.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketHelpers.java index 98b5b67b7cf5f..d2a53ca343bf2 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketHelpers.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketHelpers.java @@ -65,7 +65,7 @@ public static enum GapPolicy { public static GapPolicy parse(QueryParseContext context, String text, XContentLocation tokenLocation) { GapPolicy result = null; for (GapPolicy policy : values()) { - if (context.getParseFieldMatcher().match(text, policy.parseField)) { + if (policy.parseField.match(text)) { if (result == null) { result = policy; } else { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/BucketMetricsParser.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/BucketMetricsParser.java index 9dee002ca2905..e7954174aa3c9 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/BucketMetricsParser.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/BucketMetricsParser.java @@ -58,17 +58,17 @@ public final BucketMetricsPipelineAggregationBuilder parse(String pipelineAgg if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT)) { + if (FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { bucketsPaths = new String[] { parser.text() }; - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY)) { + } else if (GAP_POLICY.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); } else { parseToken(pipelineAggregatorName, parser, context, currentFieldName, token, params); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/percentile/PercentilesBucketPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/percentile/PercentilesBucketPipelineAggregationBuilder.java index 81df16f2bf761..cea7d01136786 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/percentile/PercentilesBucketPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/percentile/PercentilesBucketPipelineAggregationBuilder.java @@ -138,7 +138,7 @@ protected PercentilesBucketPipelineAggregationBuilder buildFactory(String pipeli @Override protected boolean token(XContentParser parser, QueryParseContext context, String field, XContentParser.Token token, Map params) throws IOException { - if (context.getParseFieldMatcher().match(field, PERCENTS_FIELD) && token == XContentParser.Token.START_ARRAY) { + if (PERCENTS_FIELD.match(field) && token == XContentParser.Token.START_ARRAY) { DoubleArrayList percents = new DoubleArrayList(10); while (parser.nextToken() != XContentParser.Token.END_ARRAY) { percents.add(parser.doubleValue()); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/stats/extended/ExtendedStatsBucketParser.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/stats/extended/ExtendedStatsBucketParser.java index b7fa49267dc55..dfa28c3dd2724 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/stats/extended/ExtendedStatsBucketParser.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketmetrics/stats/extended/ExtendedStatsBucketParser.java @@ -46,7 +46,7 @@ protected ExtendedStatsBucketPipelineAggregationBuilder buildFactory(String pipe @Override protected boolean token(XContentParser parser, QueryParseContext context, String field, XContentParser.Token token, Map params) throws IOException { - if (context.getParseFieldMatcher().match(field, SIGMA) && token == XContentParser.Token.VALUE_NUMBER) { + if (SIGMA.match(field) && token == XContentParser.Token.VALUE_NUMBER) { params.put(SIGMA.getPreferredName(), parser.doubleValue()); return true; } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketscript/BucketScriptPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketscript/BucketScriptPipelineAggregationBuilder.java index e04f26654ea27..320a84c786b15 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketscript/BucketScriptPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketscript/BucketScriptPipelineAggregationBuilder.java @@ -170,21 +170,21 @@ public static BucketScriptPipelineAggregationBuilder parse(String reducerName, Q if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT)) { + if (FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { bucketsPathsMap = new HashMap<>(); bucketsPathsMap.put("_value", parser.text()); - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY)) { + } else if (GAP_POLICY.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); - } else if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + } else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); @@ -199,9 +199,9 @@ public static BucketScriptPipelineAggregationBuilder parse(String reducerName, Q "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { Map map = parser.map(); bucketsPathsMap = new HashMap<>(); for (Map.Entry entry : map.entrySet()) { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketselector/BucketSelectorPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketselector/BucketSelectorPipelineAggregationBuilder.java index 877be6ea54f51..8a88f01175618 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketselector/BucketSelectorPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/bucketselector/BucketSelectorPipelineAggregationBuilder.java @@ -135,19 +135,19 @@ public static BucketSelectorPipelineAggregationBuilder parse(String reducerName, if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { bucketsPathsMap = new HashMap<>(); bucketsPathsMap.put("_value", parser.text()); - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY)) { + } else if (GAP_POLICY.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); - } else if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + } else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); @@ -162,9 +162,9 @@ public static BucketSelectorPipelineAggregationBuilder parse(String reducerName, "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { Map map = parser.map(); bucketsPathsMap = new HashMap<>(); for (Map.Entry entry : map.entrySet()) { diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/cumulativesum/CumulativeSumPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/cumulativesum/CumulativeSumPipelineAggregationBuilder.java index a83787f13650e..5ac185990b488 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/cumulativesum/CumulativeSumPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/cumulativesum/CumulativeSumPipelineAggregationBuilder.java @@ -141,16 +141,16 @@ public static CumulativeSumPipelineAggregationBuilder parse(String pipelineAggre if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT)) { + if (FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { bucketsPaths = new String[] { parser.text() }; } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/derivative/DerivativePipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/derivative/DerivativePipelineAggregationBuilder.java index ded2d1102065f..bb2a1c01a505d 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/derivative/DerivativePipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/derivative/DerivativePipelineAggregationBuilder.java @@ -207,20 +207,20 @@ public static DerivativePipelineAggregationBuilder parse(String pipelineAggregat if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT_FIELD)) { + if (FORMAT_FIELD.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH_FIELD)) { + } else if (BUCKETS_PATH_FIELD.match(currentFieldName)) { bucketsPaths = new String[] { parser.text() }; - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY_FIELD)) { + } else if (GAP_POLICY_FIELD.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); - } else if (context.getParseFieldMatcher().match(currentFieldName, UNIT_FIELD)) { + } else if (UNIT_FIELD.match(currentFieldName)) { units = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH_FIELD)) { + if (BUCKETS_PATH_FIELD.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/movavg/MovAvgPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/movavg/MovAvgPipelineAggregationBuilder.java index f0aa1f8112639..dc445093f1d7b 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/movavg/MovAvgPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/movavg/MovAvgPipelineAggregationBuilder.java @@ -322,13 +322,13 @@ public static MovAvgPipelineAggregationBuilder parse( if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_NUMBER) { - if (context.getParseFieldMatcher().match(currentFieldName, WINDOW)) { + if (WINDOW.match(currentFieldName)) { window = parser.intValue(); if (window <= 0) { throw new ParsingException(parser.getTokenLocation(), "[" + currentFieldName + "] value must be a positive, " + "non-zero integer. Value supplied was [" + predict + "] in [" + pipelineAggregatorName + "]."); } - } else if (context.getParseFieldMatcher().match(currentFieldName, PREDICT)) { + } else if (PREDICT.match(currentFieldName)) { predict = parser.intValue(); if (predict <= 0) { throw new ParsingException(parser.getTokenLocation(), "[" + currentFieldName + "] value must be a positive integer." @@ -339,20 +339,20 @@ public static MovAvgPipelineAggregationBuilder parse( "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT)) { + if (FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { bucketsPaths = new String[] { parser.text() }; - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY)) { + } else if (GAP_POLICY.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); - } else if (context.getParseFieldMatcher().match(currentFieldName, MODEL)) { + } else if (MODEL.match(currentFieldName)) { model = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); @@ -364,14 +364,14 @@ public static MovAvgPipelineAggregationBuilder parse( "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, SETTINGS)) { + if (SETTINGS.match(currentFieldName)) { settings = parser.map(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + pipelineAggregatorName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.VALUE_BOOLEAN) { - if (context.getParseFieldMatcher().match(currentFieldName, MINIMIZE)) { + if (MINIMIZE.match(currentFieldName)) { minimize = parser.booleanValue(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/serialdiff/SerialDiffPipelineAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/serialdiff/SerialDiffPipelineAggregationBuilder.java index f20a4f8da42cf..0acd4c7f1b795 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/serialdiff/SerialDiffPipelineAggregationBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/pipeline/serialdiff/SerialDiffPipelineAggregationBuilder.java @@ -162,18 +162,18 @@ public static SerialDiffPipelineAggregationBuilder parse(String reducerName, Que if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.VALUE_STRING) { - if (context.getParseFieldMatcher().match(currentFieldName, FORMAT)) { + if (FORMAT.match(currentFieldName)) { format = parser.text(); - } else if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + } else if (BUCKETS_PATH.match(currentFieldName)) { bucketsPaths = new String[] { parser.text() }; - } else if (context.getParseFieldMatcher().match(currentFieldName, GAP_POLICY)) { + } else if (GAP_POLICY.match(currentFieldName)) { gapPolicy = GapPolicy.parse(context, parser.text(), parser.getTokenLocation()); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.VALUE_NUMBER) { - if (context.getParseFieldMatcher().match(currentFieldName, LAG)) { + if (LAG.match(currentFieldName)) { lag = parser.intValue(true); if (lag <= 0) { throw new ParsingException(parser.getTokenLocation(), @@ -186,7 +186,7 @@ public static SerialDiffPipelineAggregationBuilder parse(String reducerName, Que "Unknown key for a " + token + " in [" + reducerName + "]: [" + currentFieldName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, BUCKETS_PATH)) { + if (BUCKETS_PATH.match(currentFieldName)) { List paths = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { String path = parser.text(); diff --git a/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index f7ffcfea13752..b7ac57be43eda 100644 --- a/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -931,32 +931,32 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (context.getParseFieldMatcher().match(currentFieldName, FROM_FIELD)) { + if (FROM_FIELD.match(currentFieldName)) { from = parser.intValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, SIZE_FIELD)) { + } else if (SIZE_FIELD.match(currentFieldName)) { size = parser.intValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, TIMEOUT_FIELD)) { + } else if (TIMEOUT_FIELD.match(currentFieldName)) { timeout = TimeValue.parseTimeValue(parser.text(), null, TIMEOUT_FIELD.getPreferredName()); - } else if (context.getParseFieldMatcher().match(currentFieldName, TERMINATE_AFTER_FIELD)) { + } else if (TERMINATE_AFTER_FIELD.match(currentFieldName)) { terminateAfter = parser.intValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, MIN_SCORE_FIELD)) { + } else if (MIN_SCORE_FIELD.match(currentFieldName)) { minScore = parser.floatValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, VERSION_FIELD)) { + } else if (VERSION_FIELD.match(currentFieldName)) { version = parser.booleanValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, EXPLAIN_FIELD)) { + } else if (EXPLAIN_FIELD.match(currentFieldName)) { explain = parser.booleanValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, TRACK_SCORES_FIELD)) { + } else if (TRACK_SCORES_FIELD.match(currentFieldName)) { trackScores = parser.booleanValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, _SOURCE_FIELD)) { + } else if (_SOURCE_FIELD.match(currentFieldName)) { fetchSourceContext = FetchSourceContext.parse(context.parser()); - } else if (context.getParseFieldMatcher().match(currentFieldName, STORED_FIELDS_FIELD)) { + } else if (STORED_FIELDS_FIELD.match(currentFieldName)) { storedFieldsContext = StoredFieldsContext.fromXContent(SearchSourceBuilder.STORED_FIELDS_FIELD.getPreferredName(), context); - } else if (context.getParseFieldMatcher().match(currentFieldName, SORT_FIELD)) { + } else if (SORT_FIELD.match(currentFieldName)) { sort(parser.text()); - } else if (context.getParseFieldMatcher().match(currentFieldName, PROFILE_FIELD)) { + } else if (PROFILE_FIELD.match(currentFieldName)) { profile = parser.booleanValue(); - } else if (context.getParseFieldMatcher().match(currentFieldName, FIELDS_FIELD)) { + } else if (FIELDS_FIELD.match(currentFieldName)) { throw new ParsingException(parser.getTokenLocation(), "Deprecated field [" + SearchSourceBuilder.FIELDS_FIELD + "] used, expected [" + SearchSourceBuilder.STORED_FIELDS_FIELD + "] instead"); @@ -965,18 +965,18 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser parser.getTokenLocation()); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, QUERY_FIELD)) { + if (QUERY_FIELD.match(currentFieldName)) { queryBuilder = context.parseInnerQueryBuilder(); - } else if (context.getParseFieldMatcher().match(currentFieldName, POST_FILTER_FIELD)) { + } else if (POST_FILTER_FIELD.match(currentFieldName)) { postQueryBuilder = context.parseInnerQueryBuilder(); - } else if (context.getParseFieldMatcher().match(currentFieldName, _SOURCE_FIELD)) { + } else if (_SOURCE_FIELD.match(currentFieldName)) { fetchSourceContext = FetchSourceContext.parse(context.parser()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SCRIPT_FIELDS_FIELD)) { + } else if (SCRIPT_FIELDS_FIELD.match(currentFieldName)) { scriptFields = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { scriptFields.add(new ScriptField(context)); } - } else if (context.getParseFieldMatcher().match(currentFieldName, INDICES_BOOST_FIELD)) { + } else if (INDICES_BOOST_FIELD.match(currentFieldName)) { DEPRECATION_LOGGER.deprecated( "Object format in indices_boost is deprecated, please use array format instead"); while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { @@ -989,19 +989,19 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser " in [" + currentFieldName + "].", parser.getTokenLocation()); } } - } else if (context.getParseFieldMatcher().match(currentFieldName, AGGREGATIONS_FIELD) - || context.getParseFieldMatcher().match(currentFieldName, AGGS_FIELD)) { + } else if (AGGREGATIONS_FIELD.match(currentFieldName) + || AGGS_FIELD.match(currentFieldName)) { aggregations = aggParsers.parseAggregators(context); - } else if (context.getParseFieldMatcher().match(currentFieldName, HIGHLIGHT_FIELD)) { + } else if (HIGHLIGHT_FIELD.match(currentFieldName)) { highlightBuilder = HighlightBuilder.fromXContent(context); - } else if (context.getParseFieldMatcher().match(currentFieldName, SUGGEST_FIELD)) { + } else if (SUGGEST_FIELD.match(currentFieldName)) { suggestBuilder = SuggestBuilder.fromXContent(context, suggesters); - } else if (context.getParseFieldMatcher().match(currentFieldName, SORT_FIELD)) { + } else if (SORT_FIELD.match(currentFieldName)) { sorts = new ArrayList<>(SortBuilder.fromXContent(context)); - } else if (context.getParseFieldMatcher().match(currentFieldName, RESCORE_FIELD)) { + } else if (RESCORE_FIELD.match(currentFieldName)) { rescoreBuilders = new ArrayList<>(); rescoreBuilders.add(RescoreBuilder.parseFromXContent(context)); - } else if (context.getParseFieldMatcher().match(currentFieldName, EXT_FIELD)) { + } else if (EXT_FIELD.match(currentFieldName)) { extBuilders = new ArrayList<>(); String extSectionName = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { @@ -1019,16 +1019,16 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser extBuilders.add(searchExtBuilder); } } - } else if (context.getParseFieldMatcher().match(currentFieldName, SLICE)) { + } else if (SLICE.match(currentFieldName)) { sliceBuilder = SliceBuilder.fromXContent(context); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].", parser.getTokenLocation()); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, STORED_FIELDS_FIELD)) { + if (STORED_FIELDS_FIELD.match(currentFieldName)) { storedFieldsContext = StoredFieldsContext.fromXContent(STORED_FIELDS_FIELD.getPreferredName(), context); - } else if (context.getParseFieldMatcher().match(currentFieldName, DOCVALUE_FIELDS_FIELD)) { + } else if (DOCVALUE_FIELDS_FIELD.match(currentFieldName)) { docValueFields = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -1038,18 +1038,18 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser "] in [" + currentFieldName + "] but found [" + token + "]", parser.getTokenLocation()); } } - } else if (context.getParseFieldMatcher().match(currentFieldName, INDICES_BOOST_FIELD)) { + } else if (INDICES_BOOST_FIELD.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { indexBoosts.add(new IndexBoost(context)); } - } else if (context.getParseFieldMatcher().match(currentFieldName, SORT_FIELD)) { + } else if (SORT_FIELD.match(currentFieldName)) { sorts = new ArrayList<>(SortBuilder.fromXContent(context)); - } else if (context.getParseFieldMatcher().match(currentFieldName, RESCORE_FIELD)) { + } else if (RESCORE_FIELD.match(currentFieldName)) { rescoreBuilders = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { rescoreBuilders.add(RescoreBuilder.parseFromXContent(context)); } - } else if (context.getParseFieldMatcher().match(currentFieldName, STATS_FIELD)) { + } else if (STATS_FIELD.match(currentFieldName)) { stats = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { @@ -1059,11 +1059,11 @@ public void parseXContent(QueryParseContext context, AggregatorParsers aggParser "] in [" + currentFieldName + "] but found [" + token + "]", parser.getTokenLocation()); } } - } else if (context.getParseFieldMatcher().match(currentFieldName, _SOURCE_FIELD)) { + } else if (_SOURCE_FIELD.match(currentFieldName)) { fetchSourceContext = FetchSourceContext.parse(context.parser()); - } else if (context.getParseFieldMatcher().match(currentFieldName, SEARCH_AFTER)) { + } else if (SEARCH_AFTER.match(currentFieldName)) { searchAfterBuilder = SearchAfterBuilder.fromXContent(parser, context.getParseFieldMatcher()); - } else if (context.getParseFieldMatcher().match(currentFieldName, FIELDS_FIELD)) { + } else if (FIELDS_FIELD.match(currentFieldName)) { throw new ParsingException(parser.getTokenLocation(), "The field [" + SearchSourceBuilder.FIELDS_FIELD + "] is no longer supported, please use [" + SearchSourceBuilder.STORED_FIELDS_FIELD + "] to retrieve stored fields or _source filtering " + @@ -1341,16 +1341,16 @@ public ScriptField(QueryParseContext context) throws IOException { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (context.getParseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) { + if (SCRIPT_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); - } else if (context.getParseFieldMatcher().match(currentFieldName, IGNORE_FAILURE_FIELD)) { + } else if (IGNORE_FAILURE_FIELD.match(currentFieldName)) { ignoreFailure = parser.booleanValue(); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName + "].", parser.getTokenLocation()); } } else if (token == XContentParser.Token.START_OBJECT) { - if (context.getParseFieldMatcher().match(currentFieldName, SCRIPT_FIELD)) { + if (SCRIPT_FIELD.match(currentFieldName)) { script = Script.parse(parser, context.getParseFieldMatcher(), context.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), "Unknown key for a " + token + " in [" + currentFieldName 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 530c13ca2ceea..4311f975c1d59 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 @@ -111,7 +111,7 @@ private MultiValuesSourceParser(boolean formattable, ValuesSourceType valuesSour while (parser.nextToken() != XContentParser.Token.END_OBJECT) { parseMissingAndAdd(aggregationName, currentFieldName, parser, missingMap); } - } else if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + } else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts."); @@ -121,7 +121,7 @@ private MultiValuesSourceParser(boolean formattable, ValuesSourceType valuesSour "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]."); } } else if (token == XContentParser.Token.START_ARRAY) { - if (context.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { throw new ParsingException(parser.getTokenLocation(), "Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " + "Multi-field aggregations do not support scripts.");