From f74fa7511bdf87bae3a340820151f31f3ce07792 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 22 Sep 2011 13:53:40 +0300 Subject: [PATCH] better failure when failing to find mapping for the key field in data histogram --- .../facet/datehistogram/DateHistogramFacetProcessor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java index 9acdf777484..0df6bb8387a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/datehistogram/DateHistogramFacetProcessor.java @@ -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"); }