If no mapping can be found for value field, throw a proper exception.
This commit is contained in:
parent
13845e47d6
commit
31fd7764e7
|
@ -121,7 +121,9 @@ public class TermsStatsFacetParser extends AbstractComponent implements FacetPar
|
|||
SearchScript valueScript = null;
|
||||
if (valueField != null) {
|
||||
FieldMapper fieldMapper = context.smartNameFieldMapper(valueField);
|
||||
if (!(fieldMapper instanceof NumberFieldMapper)) {
|
||||
if (fieldMapper == null) {
|
||||
throw new FacetPhaseExecutionException(facetName, "failed to find mapping for " + valueField);
|
||||
} else if (!(fieldMapper instanceof NumberFieldMapper)) {
|
||||
throw new FacetPhaseExecutionException(facetName, "value_field [" + valueField + "] isn't a number field, but a " + fieldMapper.fieldDataType().getType());
|
||||
}
|
||||
valueIndexFieldData = context.fieldData().getForField(fieldMapper);
|
||||
|
|
Loading…
Reference in New Issue