Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.elasticsearch.search.aggregations.matrix.stats;

import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.search.MultiValueMode;
import org.elasticsearch.search.aggregations.support.MultiValuesSourceParser.NumericValuesSourceParser;
Expand All @@ -39,7 +40,7 @@ public MatrixStatsParser() {
@Override
protected boolean token(String aggregationName, String currentFieldName, XContentParser.Token token, XContentParser parser,
Map<ParseField, Object> otherOptions) throws IOException {
if (MULTIVALUE_MODE_FIELD.match(currentFieldName)) {
if (MULTIVALUE_MODE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be

 +        if (MULTIVALUE_MODE_FIELD.match(currentFieldName, parser.getDeprecationHandler())) { 

if (token == XContentParser.Token.VALUE_STRING) {
otherOptions.put(MULTIVALUE_MODE_FIELD, parser.text());
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.script.Script;
import org.elasticsearch.search.aggregations.AggregationBuilder.CommonFields;
Expand Down Expand Up @@ -88,11 +89,11 @@ private MultiValuesSourceParser(boolean formattable, ValuesSourceType valuesSour
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.VALUE_STRING) {
if (CommonFields.FIELDS.match(currentFieldName)) {
if (CommonFields.FIELDS.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
fields = Collections.singletonList(parser.text());
} else if (formattable && CommonFields.FORMAT.match(currentFieldName)) {
} else if (formattable && CommonFields.FORMAT.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
format = parser.text();
} else if (CommonFields.VALUE_TYPE.match(currentFieldName)) {
} else if (CommonFields.VALUE_TYPE.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
throw new ParsingException(parser.getTokenLocation(),
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
"Multi-field aggregations do not support scripts.");
Expand All @@ -101,12 +102,12 @@ private MultiValuesSourceParser(boolean formattable, ValuesSourceType valuesSour
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
}
} else if (token == XContentParser.Token.START_OBJECT) {
if (CommonFields.MISSING.match(currentFieldName)) {
if (CommonFields.MISSING.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
missingMap = new HashMap<>();
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
parseMissingAndAdd(aggregationName, currentFieldName, parser, missingMap);
}
} else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) {
} else if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
throw new ParsingException(parser.getTokenLocation(),
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
"Multi-field aggregations do not support scripts.");
Expand All @@ -116,11 +117,11 @@ private MultiValuesSourceParser(boolean formattable, ValuesSourceType valuesSour
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "].");
}
} else if (token == XContentParser.Token.START_ARRAY) {
if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName)) {
if (Script.SCRIPT_PARSE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
throw new ParsingException(parser.getTokenLocation(),
"Unexpected token " + token + " [" + currentFieldName + "] in [" + aggregationName + "]. " +
"Multi-field aggregations do not support scripts.");
} else if (CommonFields.FIELDS.match(currentFieldName)) {
} else if (CommonFields.FIELDS.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
fields = new ArrayList<>();
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
if (token == XContentParser.Token.VALUE_STRING) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.fielddata.IndexOrdinalsFieldData;
Expand Down Expand Up @@ -257,27 +258,27 @@ public static HasChildQueryBuilder fromXContent(XContentParser parser) throws IO
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_OBJECT) {
if (QUERY_FIELD.match(currentFieldName)) {
if (QUERY_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
iqb = parseInnerQueryBuilder(parser);
} else if (INNER_HITS_FIELD.match(currentFieldName)) {
} else if (INNER_HITS_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
innerHitBuilder = InnerHitBuilder.fromXContent(parser);
} else {
throw new ParsingException(parser.getTokenLocation(), "[has_child] query does not support [" + currentFieldName + "]");
}
} else if (token.isValue()) {
if (TYPE_FIELD.match(currentFieldName)) {
if (TYPE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
childType = parser.text();
} else if (SCORE_MODE_FIELD.match(currentFieldName)) {
} else if (SCORE_MODE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
scoreMode = NestedQueryBuilder.parseScoreMode(parser.text());
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
boost = parser.floatValue();
} else if (MIN_CHILDREN_FIELD.match(currentFieldName)) {
} else if (MIN_CHILDREN_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
minChildren = parser.intValue(true);
} else if (MAX_CHILDREN_FIELD.match(currentFieldName)) {
} else if (MAX_CHILDREN_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
maxChildren = parser.intValue(true);
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName)) {
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
ignoreUnmapped = parser.booleanValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
queryName = parser.text();
} else {
throw new ParsingException(parser.getTokenLocation(), "[has_child] query does not support [" + currentFieldName + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.fielddata.plain.SortedSetDVOrdinalsIndexFieldData;
Expand Down Expand Up @@ -295,24 +296,24 @@ public static HasParentQueryBuilder fromXContent(XContentParser parser) throws I
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_OBJECT) {
if (QUERY_FIELD.match(currentFieldName)) {
if (QUERY_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
iqb = parseInnerQueryBuilder(parser);
} else if (INNER_HITS_FIELD.match(currentFieldName)) {
} else if (INNER_HITS_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
innerHits = InnerHitBuilder.fromXContent(parser);
} else {
throw new ParsingException(parser.getTokenLocation(),
"[has_parent] query does not support [" + currentFieldName + "]");
}
} else if (token.isValue()) {
if (TYPE_FIELD.match(currentFieldName)) {
if (TYPE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
parentType = parser.text();
} else if (SCORE_FIELD.match(currentFieldName)) {
} else if (SCORE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
score = parser.booleanValue();
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName)) {
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
ignoreUnmapped = parser.booleanValue();
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
boost = parser.floatValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
queryName = parser.text();
} else {
throw new ParsingException(parser.getTokenLocation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.mapper.DocumentMapper;
Expand Down Expand Up @@ -132,15 +133,15 @@ public static ParentIdQueryBuilder fromXContent(XContentParser parser) throws IO
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token.isValue()) {
if (TYPE_FIELD.match(currentFieldName)) {
if (TYPE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
type = parser.text();
} else if (ID_FIELD.match(currentFieldName)) {
} else if (ID_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
id = parser.text();
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName)) {
} else if (IGNORE_UNMAPPED_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
ignoreUnmapped = parser.booleanValue();
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
boost = parser.floatValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
queryName = parser.text();
} else {
throw new ParsingException(parser.getTokenLocation(), "[parent_id] query does not support [" + currentFieldName + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.lucene.search.Queries;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
Expand Down Expand Up @@ -403,7 +404,7 @@ public static PercolateQueryBuilder fromXContent(XContentParser parser) throws I
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_ARRAY) {
if (DOCUMENTS_FIELD.match(currentFieldName)) {
if (DOCUMENTS_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
if (documentSpecified) {
throw new IllegalArgumentException("[" + PercolateQueryBuilder.NAME +
"] Either specified [document] or [documents], not both");
Expand All @@ -426,7 +427,7 @@ public static PercolateQueryBuilder fromXContent(XContentParser parser) throws I
"] query does not field name [" + currentFieldName + "]");
}
} else if (token == XContentParser.Token.START_OBJECT) {
if (DOCUMENT_FIELD.match(currentFieldName)) {
if (DOCUMENT_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
if (documentsSpecified) {
throw new IllegalArgumentException("[" + PercolateQueryBuilder.NAME +
"] Either specified [document] or [documents], not both");
Expand All @@ -442,27 +443,27 @@ public static PercolateQueryBuilder fromXContent(XContentParser parser) throws I
"] query does not support field name [" + currentFieldName + "]");
}
} else if (token.isValue() || token == XContentParser.Token.VALUE_NULL) {
if (QUERY_FIELD.match(currentFieldName)) {
if (QUERY_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
field = parser.text();
} else if (NAME_FIELD.match(currentFieldName)) {
} else if (NAME_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
name = parser.textOrNull();
} else if (DOCUMENT_TYPE_FIELD.match(currentFieldName)) {
} else if (DOCUMENT_TYPE_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
documentType = parser.textOrNull();
} else if (INDEXED_DOCUMENT_FIELD_INDEX.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_INDEX.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentIndex = parser.text();
} else if (INDEXED_DOCUMENT_FIELD_TYPE.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_TYPE.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentType = parser.text();
} else if (INDEXED_DOCUMENT_FIELD_ID.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_ID.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentId = parser.text();
} else if (INDEXED_DOCUMENT_FIELD_ROUTING.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_ROUTING.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentRouting = parser.text();
} else if (INDEXED_DOCUMENT_FIELD_PREFERENCE.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_PREFERENCE.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentPreference = parser.text();
} else if (INDEXED_DOCUMENT_FIELD_VERSION.match(currentFieldName)) {
} else if (INDEXED_DOCUMENT_FIELD_VERSION.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
indexedDocumentVersion = parser.longValue();
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
boost = parser.floatValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName)) {
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, LoggingDeprecationHandler.INSTANCE)) {
queryName = parser.text();
} else {
throw new ParsingException(parser.getTokenLocation(), "[" + PercolateQueryBuilder.NAME +
Expand Down
Loading