diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java index c480fc03926..df6d4016456 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java @@ -462,6 +462,9 @@ public final class XContentBuilder { } public XContentBuilder value(Object value) throws IOException { + if (value == null) { + return nullValue(); + } Class type = value.getClass(); if (type == String.class) { value((String) value); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index aaf088eb3e9..0613456dfc1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -97,6 +97,9 @@ public class RestSearchAction extends BaseRestHandler { builder.endObject(); channel.sendResponse(new XContentRestResponse(request, OK, builder)); } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("failed to execute search (building response)", e); + } onFailure(e); } }