More lenient type parsing in histo/cardinality aggs
closes #6948 closes #6893
This commit is contained in:
parent
b0ce090876
commit
8dca4b7e07
|
@ -65,16 +65,12 @@ public class HistogramParser implements Aggregator.Parser {
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
} else if (vsParser.token(currentFieldName, token, parser)) {
|
} else if (vsParser.token(currentFieldName, token, parser)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
} else if (token.isValue()) {
|
||||||
if ("interval".equals(currentFieldName)) {
|
if ("interval".equals(currentFieldName)) {
|
||||||
interval = parser.longValue();
|
interval = parser.longValue();
|
||||||
} else if ("min_doc_count".equals(currentFieldName) || "minDocCount".equals(currentFieldName)) {
|
} else if ("min_doc_count".equals(currentFieldName) || "minDocCount".equals(currentFieldName)) {
|
||||||
minDocCount = parser.longValue();
|
minDocCount = parser.longValue();
|
||||||
} else {
|
} else if ("keyed".equals(currentFieldName)) {
|
||||||
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: [" + currentFieldName + "].");
|
|
||||||
}
|
|
||||||
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
|
||||||
if ("keyed".equals(currentFieldName)) {
|
|
||||||
keyed = parser.booleanValue();
|
keyed = parser.booleanValue();
|
||||||
} else {
|
} else {
|
||||||
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: [" + currentFieldName + "].");
|
throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: [" + currentFieldName + "].");
|
||||||
|
|
|
@ -56,14 +56,10 @@ public class CardinalityParser implements Aggregator.Parser {
|
||||||
currentFieldName = parser.currentName();
|
currentFieldName = parser.currentName();
|
||||||
} else if (vsParser.token(currentFieldName, token, parser)) {
|
} else if (vsParser.token(currentFieldName, token, parser)) {
|
||||||
continue;
|
continue;
|
||||||
} else if (token == XContentParser.Token.VALUE_BOOLEAN) {
|
} else if (token.isValue()) {
|
||||||
if ("rehash".equals(currentFieldName)) {
|
if ("rehash".equals(currentFieldName)) {
|
||||||
rehash = parser.booleanValue();
|
rehash = parser.booleanValue();
|
||||||
} else {
|
} else if (PRECISION_THRESHOLD.match(currentFieldName)) {
|
||||||
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
|
|
||||||
}
|
|
||||||
} else if (token == XContentParser.Token.VALUE_NUMBER) {
|
|
||||||
if (PRECISION_THRESHOLD.match(currentFieldName)) {
|
|
||||||
precisionThreshold = parser.longValue();
|
precisionThreshold = parser.longValue();
|
||||||
} else {
|
} else {
|
||||||
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
|
throw new SearchParseException(context, "Unknown key for a " + token + " in [" + name + "]: [" + currentFieldName + "].");
|
||||||
|
|
Loading…
Reference in New Issue