diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/TextExpansionQueryBuilder.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/TextExpansionQueryBuilder.java index e340a6888458c..99de6c70955b5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/TextExpansionQueryBuilder.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/TextExpansionQueryBuilder.java @@ -247,8 +247,8 @@ public static TextExpansionQueryBuilder fromXContent(XContentParser parser) thro threshold = WeightedTokensThreshold.fromXContent(parser); } else { throw new ParsingException( - parser.getTokenLocation(), - "[" + NAME + "] unknown token [" + token + "] after [" + currentFieldName + "]" + parser.getTokenLocation(), + "[" + NAME + "] unknown token [" + token + "] after [" + currentFieldName + "]" ); } } else if (token.isValue()) { @@ -288,12 +288,7 @@ public static TextExpansionQueryBuilder fromXContent(XContentParser parser) thro throw new ParsingException(parser.getTokenLocation(), "No fieldname specified for query"); } - TextExpansionQueryBuilder queryBuilder = new TextExpansionQueryBuilder( - fieldName, - modelText, - modelId, - threshold - ); + TextExpansionQueryBuilder queryBuilder = new TextExpansionQueryBuilder(fieldName, modelText, modelId, threshold); queryBuilder.queryName(queryName); queryBuilder.boost(boost); return queryBuilder; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensQueryBuilder.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensQueryBuilder.java index 960def8d551be..dc54da89c672b 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensQueryBuilder.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensQueryBuilder.java @@ -35,7 +35,6 @@ import static org.elasticsearch.xpack.ml.queries.WeightedTokensThreshold.TOKENS_THRESHOLD_FIELD; - public class WeightedTokensQueryBuilder extends AbstractQueryBuilder { public static final String NAME = "weighted_tokens"; @@ -205,8 +204,8 @@ public static WeightedTokensQueryBuilder fromXContent(XContentParser parser) thr } else if (TOKENS_THRESHOLD_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { if (token != XContentParser.Token.START_OBJECT) { throw new ParsingException( - parser.getTokenLocation(), - "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] should be an object" + parser.getTokenLocation(), + "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] should be an object" ); } threshold = WeightedTokensThreshold.fromXContent(parser); @@ -235,11 +234,7 @@ public static WeightedTokensQueryBuilder fromXContent(XContentParser parser) thr throw new ParsingException(parser.getTokenLocation(), "No fieldname specified for query"); } - var qb = new WeightedTokensQueryBuilder( - fieldName, - tokens, - threshold - ); + var qb = new WeightedTokensQueryBuilder(fieldName, tokens, threshold); qb.queryName(queryName); qb.boost(boost); return qb; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensThreshold.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensThreshold.java index e02dd335d633f..8a2919e3475d4 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensThreshold.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/queries/WeightedTokensThreshold.java @@ -137,14 +137,14 @@ public static WeightedTokensThreshold fromXContent(XContentParser parser) throws onlyScorePrunedTokens = parser.booleanValue(); } else { throw new ParsingException( - parser.getTokenLocation(), - "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] does not support [" + currentFieldName + "]" + parser.getTokenLocation(), + "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] does not support [" + currentFieldName + "]" ); } } else { throw new ParsingException( - parser.getTokenLocation(), - "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] unknown token [" + token + "] after [" + currentFieldName + "]" + parser.getTokenLocation(), + "[" + TOKENS_THRESHOLD_FIELD.getPreferredName() + "] unknown token [" + token + "] after [" + currentFieldName + "]" ); } }