diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhase.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhase.java index 8a26ab3ea4a..3233e38cce7 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhase.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhase.java @@ -85,7 +85,7 @@ public class QueryPhase implements SearchPhase { } searchContext.queryResult().topDocs(topDocs); } catch (Exception e) { - throw new QueryPhaseExecutionException(searchContext); + throw new QueryPhaseExecutionException(searchContext, e); } facetsPhase.execute(searchContext); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhaseExecutionException.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhaseExecutionException.java index d52306021ce..dd7f8f82f32 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhaseExecutionException.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QueryPhaseExecutionException.java @@ -27,7 +27,7 @@ import org.elasticsearch.search.internal.SearchContext; */ public class QueryPhaseExecutionException extends SearchException { - public QueryPhaseExecutionException(SearchContext context) { - super("Failed to execute query [" + context.query() + "], sort [" + context.sort() + "], from [" + context.from() + "], size [" + context.size() + "]"); + public QueryPhaseExecutionException(SearchContext context, Throwable cause) { + super("Failed to execute query [" + context.query() + "], sort [" + context.sort() + "], from [" + context.from() + "], size [" + context.size() + "]", cause); } }