From 5ea58a338797c6ea633fb0c8de37680b739f6a45 Mon Sep 17 00:00:00 2001 From: Alberto Paro Date: Thu, 10 Feb 2011 14:07:08 +0100 Subject: [PATCH] Don't fail search if highlight field is missing for a specific type. Close #682 --- .../org/elasticsearch/search/highlight/HighlightPhase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightPhase.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightPhase.java index 83e8d6ab270..56d5edfc763 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightPhase.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/highlight/HighlightPhase.java @@ -72,7 +72,8 @@ public class HighlightPhase implements SearchHitPhase { for (SearchContextHighlight.Field field : context.highlight().fields()) { FieldMapper mapper = documentMapper.mappers().smartNameFieldMapper(field.field()); if (mapper == null) { - throw new SearchException(context.shardTarget(), "No mapping found for [" + field.field() + "]"); + //Save skipping missing fields + continue; } // if we can do highlighting using Term Vectors, use FastVectorHighlighter, otherwise, use the