From d5aa35e0eafde434b6d7f93c3f347c44667cedd2 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 18 Sep 2012 13:20:00 +0200 Subject: [PATCH] Added better error handling for has_child, has_parent and top_children. If has_parent, has_child or top_children are executed incorrectly then a better exception is thrown. This gives a better error description when one of these queries or filters is being used in count api. Closes #2261 --- .../action/count/TransportCountAction.java | 4 +- .../index/search/child/HasChildFilter.java | 8 ++++ .../index/search/child/HasParentFilter.java | 8 ++++ .../index/search/child/TopChildrenQuery.java | 8 ++++ .../child/SimpleChildQuerySearchTests.java | 40 +++++++++++++++++++ 5 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/action/count/TransportCountAction.java b/src/main/java/org/elasticsearch/action/count/TransportCountAction.java index 21b946619d1..f97d4d91580 100644 --- a/src/main/java/org/elasticsearch/action/count/TransportCountAction.java +++ b/src/main/java/org/elasticsearch/action/count/TransportCountAction.java @@ -39,6 +39,7 @@ import org.elasticsearch.index.service.IndexService; import org.elasticsearch.index.shard.service.IndexShard; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.script.ScriptService; +import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.internal.InternalSearchRequest; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.query.QueryPhaseExecutionException; @@ -145,9 +146,10 @@ public class TransportCountAction extends TransportBroadcastOperationAction