Minor indentation/validation fix in AggregatorParsers.
This commit is contained in:
parent
ef4a910078
commit
f00a9b8557
|
@ -154,6 +154,12 @@ public class AggregatorParsers {
|
|||
throw new SearchParseException(context, "Found two aggregation type definitions in [" + aggregationName + "]: ["
|
||||
+ aggFactory.type + "] and [" + fieldName + "]");
|
||||
}
|
||||
if (reducerFactory != null) {
|
||||
// TODO we would need a .type property on reducers too for this error message?
|
||||
throw new SearchParseException(context, "Found two aggregation type definitions in [" + aggregationName + "]: ["
|
||||
+ reducerFactory + "] and [" + fieldName + "]");
|
||||
}
|
||||
|
||||
Aggregator.Parser aggregatorParser = parser(fieldName);
|
||||
if (aggregatorParser == null) {
|
||||
Reducer.Parser reducerParser = reducer(fieldName);
|
||||
|
@ -172,6 +178,7 @@ public class AggregatorParsers {
|
|||
if (aggFactory == null && reducerFactory == null) {
|
||||
throw new SearchParseException(context, "Missing definition for aggregation [" + aggregationName + "]");
|
||||
} else if (aggFactory != null) {
|
||||
assert reducerFactory == null;
|
||||
if (metaData != null) {
|
||||
aggFactory.setMetaData(metaData);
|
||||
}
|
||||
|
@ -185,13 +192,13 @@ public class AggregatorParsers {
|
|||
}
|
||||
|
||||
factories.addAggregator(aggFactory);
|
||||
} else if (reducerFactory != null) {
|
||||
} else {
|
||||
assert reducerFactory != null;
|
||||
if (subFactories != null) {
|
||||
throw new SearchParseException(context, "Aggregation [" + aggregationName + "] cannot define sub-aggregations");
|
||||
}
|
||||
// TODO: should we validate here like aggs?
|
||||
factories.addReducer(reducerFactory);
|
||||
} else {
|
||||
throw new SearchParseException(context, "Found two sub aggregation definitions under [" + aggregationName + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue