better failure when failing to find mapping for the key field in data histogram

This commit is contained in:
Shay Banon 2011-09-22 13:53:40 +03:00
parent 55d112b043
commit f74fa7511b
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ public class DateHistogramFacetProcessor extends AbstractComponent implements Fa
}
FieldMapper mapper = context.mapperService().smartNameFieldMapper(keyField);
if (mapper == null) {
throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] not found");
}
if (mapper.fieldDataType() != FieldDataType.DefaultTypes.LONG) {
throw new FacetPhaseExecutionException(facetName, "(key) field [" + keyField + "] is not of type date");
}