diff --git a/src/main/java/org/elasticsearch/index/query/FieldQueryParser.java b/src/main/java/org/elasticsearch/index/query/FieldQueryParser.java index 820a0d4f34a..88f86fc5d5e 100644 --- a/src/main/java/org/elasticsearch/index/query/FieldQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/FieldQueryParser.java @@ -166,6 +166,9 @@ public class FieldQueryParser implements QueryParser { try { query = queryParser.parse(qpSettings.queryString()); + if (query == null) { + return null; + } query.setBoost(qpSettings.boost()); query = optimizeQuery(fixNegativeQueryIfNeeded(query)); if (query instanceof BooleanQuery) { diff --git a/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java b/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java index b46bbb50fbd..c2bf9674b10 100644 --- a/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/MatchQueryParser.java @@ -139,6 +139,9 @@ public class MatchQueryParser implements QueryParser { } Query query = matchQuery.parse(type, fieldName, text); + if (query == null) { + return null; + } if (query instanceof BooleanQuery) { Queries.applyMinimumShouldMatch((BooleanQuery) query, minimumShouldMatch); diff --git a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java index 7d620f90b97..282ee16a568 100644 --- a/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/MultiMatchQueryParser.java @@ -169,6 +169,9 @@ public class MultiMatchQueryParser implements QueryParser { } Query query = multiMatchQuery.parse(type, fieldNames, text); + if (query == null) { + return null; + } if (query instanceof BooleanQuery) { Queries.applyMinimumShouldMatch((BooleanQuery) query, minimumShouldMatch); diff --git a/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java b/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java index 3069d86da0c..9600090c2a4 100644 --- a/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java @@ -210,6 +210,9 @@ public class QueryStringQueryParser implements QueryParser { try { query = queryParser.parse(qpSettings.queryString()); + if (query == null) { + return null; + } query.setBoost(qpSettings.boost()); query = optimizeQuery(fixNegativeQueryIfNeeded(query)); if (query instanceof BooleanQuery) {