diff --git a/core/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java index 7866035dfac..e5416c131a6 100644 --- a/core/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/BoolQueryBuilder.java @@ -358,17 +358,17 @@ public class BoolQueryBuilder extends AbstractQueryBuilder { } } } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, DISABLE_COORD_FIELD)) { + if (DISABLE_COORD_FIELD.match(currentFieldName)) { disableCoord = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MINIMUM_SHOULD_MATCH)) { + } else if (MINIMUM_SHOULD_MATCH.match(currentFieldName)) { minimumShouldMatch = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MINIMUM_NUMBER_SHOULD_MATCH)) { + } else if (MINIMUM_NUMBER_SHOULD_MATCH.match(currentFieldName)) { minimumShouldMatch = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, ADJUST_PURE_NEGATIVE)) { + } else if (ADJUST_PURE_NEGATIVE.match(currentFieldName)) { adjustPureNegative = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "[bool] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java index 19f7a1b6ea1..cb16faf9b39 100644 --- a/core/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/BoostingQueryBuilder.java @@ -153,21 +153,21 @@ public class BoostingQueryBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, QUERIES_FIELD)) { + if (QUERIES_FIELD.match(currentFieldName)) { queriesFound = true; queries.add(parseContext.parseInnerQueryBuilder()); } else { throw new ParsingException(parser.getTokenLocation(), "[dis_max] query does not support [" + currentFieldName + "]"); } } else if (token == XContentParser.Token.START_ARRAY) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, QUERIES_FIELD)) { + if (QUERIES_FIELD.match(currentFieldName)) { queriesFound = true; while (token != XContentParser.Token.END_ARRAY) { queries.add(parseContext.parseInnerQueryBuilder()); @@ -154,11 +154,11 @@ public class DisMaxQueryBuilder extends AbstractQueryBuilder throw new ParsingException(parser.getTokenLocation(), "[dis_max] query does not support [" + currentFieldName + "]"); } } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, TIE_BREAKER_FIELD)) { + } else if (TIE_BREAKER_FIELD.match(currentFieldName)) { tieBreaker = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "[dis_max] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java index a6f85f96be4..07d652cb333 100644 --- a/core/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java @@ -96,11 +96,11 @@ public class ExistsQueryBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, FIELD_FIELD)) { + if (FIELD_FIELD.match(currentFieldName)) { fieldPattern = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); } else { throw new ParsingException(parser.getTokenLocation(), "[" + ExistsQueryBuilder.NAME + diff --git a/core/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java index 2bd384aff95..a7ef6d9551b 100644 --- a/core/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java @@ -115,7 +115,7 @@ public class FieldMaskingSpanQueryBuilder extends AbstractQueryBuilder i if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, TERM_FIELD)) { + if (TERM_FIELD.match(currentFieldName)) { value = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, VALUE_FIELD)) { + } else if (VALUE_FIELD.match(currentFieldName)) { value = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Fuzziness.FIELD)) { + } else if (Fuzziness.FIELD.match(currentFieldName)) { fuzziness = Fuzziness.parse(parser); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, PREFIX_LENGTH_FIELD)) { + } else if (PREFIX_LENGTH_FIELD.match(currentFieldName)) { prefixLength = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MAX_EXPANSIONS_FIELD)) { + } else if (MAX_EXPANSIONS_FIELD.match(currentFieldName)) { maxExpansions = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, TRANSPOSITIONS_FIELD)) { + } else if (TRANSPOSITIONS_FIELD.match(currentFieldName)) { transpositions = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, REWRITE_FIELD)) { + } else if (REWRITE_FIELD.match(currentFieldName)) { rewrite = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java index 07b39ba12c1..00371ce7a63 100644 --- a/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java @@ -408,30 +408,30 @@ public class GeoBoundingBoxQueryBuilder extends AbstractQueryBuilder(); while ((token = parser.nextToken()) != Token.END_ARRAY) { shell.add(GeoUtils.parseGeoPoint(parser)); @@ -271,16 +271,16 @@ public class GeoPolygonQueryBuilder extends AbstractQueryBuilder { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, QUERY_FIELD)) { + if (QUERY_FIELD.match(currentFieldName)) { value = parser.objectText(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, TYPE_FIELD)) { + } else if (TYPE_FIELD.match(currentFieldName)) { String tStr = parser.text(); if ("boolean".equals(tStr)) { type = MatchQuery.Type.BOOLEAN; @@ -569,31 +569,31 @@ public class MatchQueryBuilder extends AbstractQueryBuilder { } else { throw new ParsingException(parser.getTokenLocation(), "[" + NAME + "] query does not support type " + tStr); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, ANALYZER_FIELD)) { + } else if (ANALYZER_FIELD.match(currentFieldName)) { analyzer = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, SLOP_FIELD)) { + } else if (SLOP_FIELD.match(currentFieldName)) { slop = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Fuzziness.FIELD)) { + } else if (Fuzziness.FIELD.match(currentFieldName)) { fuzziness = Fuzziness.parse(parser); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, PREFIX_LENGTH_FIELD)) { + } else if (PREFIX_LENGTH_FIELD.match(currentFieldName)) { prefixLength = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MAX_EXPANSIONS_FIELD)) { + } else if (MAX_EXPANSIONS_FIELD.match(currentFieldName)) { maxExpansion = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, OPERATOR_FIELD)) { + } else if (OPERATOR_FIELD.match(currentFieldName)) { operator = Operator.fromString(parser.text()); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MINIMUM_SHOULD_MATCH_FIELD)) { + } else if (MINIMUM_SHOULD_MATCH_FIELD.match(currentFieldName)) { minimumShouldMatch = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FUZZY_REWRITE_FIELD)) { + } else if (FUZZY_REWRITE_FIELD.match(currentFieldName)) { fuzzyRewrite = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FUZZY_TRANSPOSITIONS_FIELD)) { + } else if (FUZZY_TRANSPOSITIONS_FIELD.match(currentFieldName)) { fuzzyTranspositions = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, LENIENT_FIELD)) { + } else if (LENIENT_FIELD.match(currentFieldName)) { lenient = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, CUTOFF_FREQUENCY_FIELD)) { + } else if (CUTOFF_FREQUENCY_FIELD.match(currentFieldName)) { cutOffFrequency = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, ZERO_TERMS_QUERY_FIELD)) { + } else if (ZERO_TERMS_QUERY_FIELD.match(currentFieldName)) { String zeroTermsDocs = parser.text(); if ("none".equalsIgnoreCase(zeroTermsDocs)) { zeroTermsQuery = MatchQuery.ZeroTermsQuery.NONE; @@ -603,7 +603,7 @@ public class MatchQueryBuilder extends AbstractQueryBuilder { throw new ParsingException(parser.getTokenLocation(), "Unsupported zero_terms_docs value [" + zeroTermsDocs + "]"); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), 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 e776f4953d2..e4df758f2ba 100644 --- a/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/MoreLikeThisQueryBuilder.java @@ -834,33 +834,33 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { fields.add(parser.text()); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Field.LIKE)) { + } else if (Field.LIKE.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { parseLikeField(parseContext, likeTexts, likeItems); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Field.UNLIKE)) { + } else if (Field.UNLIKE.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { parseLikeField(parseContext, unlikeTexts, unlikeItems); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Field.IDS)) { + } else if (Field.IDS.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (!token.isValue()) { throw new IllegalArgumentException("ids array element should only contain ids"); } likeItems.add(new Item(null, null, parser.text())); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Field.DOCS)) { + } else if (Field.DOCS.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token != XContentParser.Token.START_OBJECT) { throw new IllegalArgumentException("docs array element should include an object"); } likeItems.add(Item.parse(parser, parseContext.getParseFieldMatcher(), new Item())); } - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Field.STOP_WORDS)) { + } else if (Field.STOP_WORDS.match(currentFieldName)) { stopWords = new ArrayList<>(); while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { stopWords.add(parser.text()); @@ -906,9 +906,9 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_OBJECT) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, QUERY_FIELD)) { + if (QUERY_FIELD.match(currentFieldName)) { query = parseContext.parseInnerQueryBuilder(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, INNER_HITS_FIELD)) { + } else if (INNER_HITS_FIELD.match(currentFieldName)) { innerHitBuilder = InnerHitBuilder.fromXContent(parseContext); } else { throw new ParsingException(parser.getTokenLocation(), "[nested] query does not support [" + currentFieldName + "]"); } } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, PATH_FIELD)) { + if (PATH_FIELD.match(currentFieldName)) { path = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, IGNORE_UNMAPPED_FIELD)) { + } else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName)) { ignoreUnmapped = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, SCORE_MODE_FIELD)) { + } else if (SCORE_MODE_FIELD.match(currentFieldName)) { scoreMode = HasChildQueryBuilder.parseScoreMode(parser.text()); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "[nested] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/ParentIdQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/ParentIdQueryBuilder.java index f85e232032a..f5608df0703 100644 --- a/core/src/main/java/org/elasticsearch/index/query/ParentIdQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/ParentIdQueryBuilder.java @@ -128,15 +128,15 @@ public final class ParentIdQueryBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, PREFIX_FIELD)) { + } else if (PREFIX_FIELD.match(currentFieldName)) { value = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, REWRITE_FIELD)) { + } else if (REWRITE_FIELD.match(currentFieldName)) { rewrite = parser.textOrNull(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java index e9e194c6a28..f60aa56d0b9 100644 --- a/core/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuilder.java @@ -720,7 +720,7 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder i if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, FROM_FIELD)) { + if (FROM_FIELD.match(currentFieldName)) { from = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, TO_FIELD)) { + } else if (TO_FIELD.match(currentFieldName)) { to = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, INCLUDE_LOWER_FIELD)) { + } else if (INCLUDE_LOWER_FIELD.match(currentFieldName)) { includeLower = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, INCLUDE_UPPER_FIELD)) { + } else if (INCLUDE_UPPER_FIELD.match(currentFieldName)) { includeUpper = parser.booleanValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, GT_FIELD)) { + } else if (GT_FIELD.match(currentFieldName)) { from = parser.objectBytes(); includeLower = false; - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, GTE_FIELD)) { + } else if (GTE_FIELD.match(currentFieldName)) { from = parser.objectBytes(); includeLower = true; - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, LT_FIELD)) { + } else if (LT_FIELD.match(currentFieldName)) { to = parser.objectBytes(); includeUpper = false; - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, LTE_FIELD)) { + } else if (LTE_FIELD.match(currentFieldName)) { to = parser.objectBytes(); includeUpper = true; - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, TIME_ZONE_FIELD)) { + } else if (TIME_ZONE_FIELD.match(currentFieldName)) { timeZone = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FORMAT_FIELD)) { + } else if (FORMAT_FIELD.match(currentFieldName)) { format = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, RELATION_FIELD)) { + } else if (RELATION_FIELD.match(currentFieldName)) { relation = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), @@ -408,9 +408,9 @@ public class RangeQueryBuilder extends AbstractQueryBuilder i } } } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, NAME_FIELD)) { + if (NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FIELDDATA_FIELD)) { + } else if (FIELDDATA_FIELD.match(currentFieldName)) { // ignore } else { throw new ParsingException(parser.getTokenLocation(), "[range] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java index e5632e96c81..cfd7b428490 100644 --- a/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/RegexpQueryBuilder.java @@ -200,20 +200,20 @@ public class RegexpQueryBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, VALUE_FIELD)) { + if (VALUE_FIELD.match(currentFieldName)) { value = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, REWRITE_FIELD)) { + } else if (REWRITE_FIELD.match(currentFieldName)) { rewrite = parser.textOrNull(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FLAGS_FIELD)) { + } else if (FLAGS_FIELD.match(currentFieldName)) { String flags = parser.textOrNull(); flagsValue = RegexpFlag.resolveValue(flags); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, MAX_DETERMINIZED_STATES_FIELD)) { + } else if (MAX_DETERMINIZED_STATES_FIELD.match(currentFieldName)) { maxDeterminizedStates = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, FLAGS_VALUE_FIELD)) { + } else if (FLAGS_VALUE_FIELD.match(currentFieldName)) { flagsValue = parser.intValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), @@ -222,7 +222,7 @@ public class RegexpQueryBuilder extends AbstractQueryBuilder } } } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, NAME_FIELD)) { + if (NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throwParsingExceptionOnMultipleFields(NAME, parser.getTokenLocation(), fieldName, parser.currentName()); diff --git a/core/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java index 377aeb103d6..077a687ed83 100644 --- a/core/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/ScriptQueryBuilder.java @@ -99,17 +99,17 @@ public class ScriptQueryBuilder extends AbstractQueryBuilder } else if (parseContext.isDeprecatedSetting(currentFieldName)) { // skip } else if (token == XContentParser.Token.START_OBJECT) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, parseContext.getParseFieldMatcher(), parseContext.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), "[script] query does not support [" + currentFieldName + "]"); } } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, Script.SCRIPT_PARSE_FIELD)) { + } else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) { script = Script.parse(parser, parseContext.getParseFieldMatcher(), parseContext.getDefaultScriptLanguage()); } else { throw new ParsingException(parser.getTokenLocation(), "[script] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java index 8025b25c30c..4e3b9d98b1e 100644 --- a/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/SimpleQueryStringBuilder.java @@ -492,7 +492,7 @@ public class SimpleQueryStringBuilder extends AbstractQueryBuilder if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token == XContentParser.Token.START_ARRAY) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, CLAUSES_FIELD)) { + if (CLAUSES_FIELD.match(currentFieldName)) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { QueryBuilder query = parseContext.parseInnerQueryBuilder(); if (query instanceof SpanQueryBuilder == false) { @@ -123,9 +123,9 @@ public class SpanOrQueryBuilder extends AbstractQueryBuilder throw new ParsingException(parser.getTokenLocation(), "[span_or] query does not support [" + currentFieldName + "]"); } } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), "[span_or] query does not support [" + currentFieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java index fae55b35e66..67319dfe6e4 100644 --- a/core/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/SpanTermQueryBuilder.java @@ -109,13 +109,13 @@ public class SpanTermQueryBuilder extends BaseTermQueryBuilder { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else { - if (parseContext.getParseFieldMatcher().match(currentFieldName, TERM_FIELD)) { + if (TERM_FIELD.match(currentFieldName)) { value = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, VALUE_FIELD)) { + } else if (VALUE_FIELD.match(currentFieldName)) { value = parser.objectBytes(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java index c301aedcd89..7ef57a8a79e 100644 --- a/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java @@ -353,9 +353,9 @@ public class TermsQueryBuilder extends AbstractQueryBuilder { fieldName = currentFieldName; termsLookup = TermsLookup.parseTermsLookup(parser); } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + } else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java index e7fb520faf1..88e655555f8 100644 --- a/core/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/TypeQueryBuilder.java @@ -93,11 +93,11 @@ public class TypeQueryBuilder extends AbstractQueryBuilder { if (token == XContentParser.Token.FIELD_NAME) { currentFieldName = parser.currentName(); } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.NAME_FIELD)) { + if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) { queryName = parser.text(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, AbstractQueryBuilder.BOOST_FIELD)) { + } else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) { boost = parser.floatValue(); - } else if (parseContext.getParseFieldMatcher().match(currentFieldName, VALUE_FIELD)) { + } else if (VALUE_FIELD.match(currentFieldName)) { type = parser.utf8Bytes(); } else { throw new ParsingException(parser.getTokenLocation(), diff --git a/core/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java index bfe173664f4..50d9c6e6a4c 100644 --- a/core/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/WildcardQueryBuilder.java @@ -153,15 +153,15 @@ public class WildcardQueryBuilder extends AbstractQueryBuilder> extends ToXC if (token == XContentParser.Token.FIELD_NAME) { fieldName = parser.currentName(); } else if (token.isValue()) { - if (parseContext.getParseFieldMatcher().match(fieldName, WINDOW_SIZE_FIELD)) { + if (WINDOW_SIZE_FIELD.match(fieldName)) { windowSize = parser.intValue(); } else { throw new ParsingException(parser.getTokenLocation(), "rescore doesn't support [" + fieldName + "]"); diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/Laplace.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/Laplace.java index 6c781a8ee91..00af02a8056 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/Laplace.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/Laplace.java @@ -112,7 +112,7 @@ public final class Laplace extends SmoothingModel { if (token == XContentParser.Token.FIELD_NAME) { fieldName = parser.currentName(); } - if (token.isValue() && parseContext.getParseFieldMatcher().match(fieldName, ALPHA_FIELD)) { + if (token.isValue() && ALPHA_FIELD.match(fieldName)) { alpha = parser.doubleValue(); } } diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoff.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoff.java index 3e67110ce7d..607ccac9747 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoff.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/StupidBackoff.java @@ -115,7 +115,7 @@ public final class StupidBackoff extends SmoothingModel { if (token == XContentParser.Token.FIELD_NAME) { fieldName = parser.currentName(); } - if (token.isValue() && parseContext.getParseFieldMatcher().match(fieldName, DISCOUNT_FIELD)) { + if (token.isValue() && DISCOUNT_FIELD.match(fieldName)) { discount = parser.doubleValue(); } } diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java index ff3a9bf1ee6..632c5022838 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQueryBuilder.java @@ -246,7 +246,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder