diff --git a/src/main/java/org/elasticsearch/index/search/child/TopChildrenQuery.java b/src/main/java/org/elasticsearch/index/search/child/TopChildrenQuery.java index 27adc2c0e34..f8982136b6c 100644 --- a/src/main/java/org/elasticsearch/index/search/child/TopChildrenQuery.java +++ b/src/main/java/org/elasticsearch/index/search/child/TopChildrenQuery.java @@ -90,8 +90,8 @@ public class TopChildrenQuery extends Query { } // Rewrite invocation logic: - // 1) query_then_fetch (default): Rewrite is execute as part of the createWeight invocation, when search child docs. - // 2) dfs_query_then_fetch:: First rewrite and then createWeight is executed. During query phase rewrite isn't + // 1) query_then|and_fetch (default): Rewrite is execute as part of the createWeight invocation, when search child docs. + // 2) dfs_query_then|and_fetch:: First rewrite and then createWeight is executed. During query phase rewrite isn't // executed any more because searchContext#queryRewritten() returns true. @Override public Query rewrite(IndexReader reader) throws IOException { @@ -127,7 +127,7 @@ public class TopChildrenQuery extends Query { if (rewrittenChildQuery == null) { childQuery = rewrittenChildQuery = searcher.rewrite(originalChildQuery); } else { - assert rewriteIndexReader == searcher.getIndexReader(); + assert rewriteIndexReader == searcher.getIndexReader() : "not equal, rewriteIndexReader=" + rewriteIndexReader + " searcher.getIndexReader()=" + searcher.getIndexReader(); childQuery = rewrittenChildQuery; } diff --git a/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java b/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java index 72adcc116b6..0a1b108c0fe 100644 --- a/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java +++ b/src/test/java/org/elasticsearch/search/child/SimpleChildQuerySearchTests.java @@ -319,7 +319,8 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest { } flushAndRefresh(); - for (int i = 0; i < 10; i++) { + for (int i = 1; i <= 10; i++) { + logger.info("Round {}", i); SearchResponse searchResponse = client().prepareSearch("test") .setQuery(constantScoreQuery(queryFilter(topChildrenQuery("child", matchAllQuery())).cache(true))).execute() .actionGet();