From 0ed50ca00c1d9abacff4f667afa3d366c9b04e01 Mon Sep 17 00:00:00 2001 From: kimchy Date: Wed, 20 Jul 2011 05:54:09 +0300 Subject: [PATCH] NullPointerException for invalid faceted query, closes #1136. --- .../org/elasticsearch/search/facet/FacetParseElement.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetParseElement.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetParseElement.java index eeb63859e77..36128b82efb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetParseElement.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facet/FacetParseElement.java @@ -127,6 +127,10 @@ public class FacetParseElement implements SearchParseElement { facet = new NestedChildrenCollector(facet, context.filterCache().cache(NonNestedDocsFilter.INSTANCE), context.filterCache().cache(objectMapper.nestedTypeFilter())); } + if (facet == null) { + throw new SearchParseException(context, "no facet type found for facet named [" + topLevelFieldName + "]"); + } + if (facetCollectors == null) { facetCollectors = Lists.newArrayList(); }