summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/SearchServiceTests.java
diff options
context:
space:
mode:
authorSimon Willnauer <simonw@apache.org>2017-04-10 09:37:52 +0200
committerGitHub <noreply@github.com>2017-04-10 09:37:52 +0200
commit1f40f8a2d23759f58ab53c24628c6f340edb5de9 (patch)
treec5b9a50db46011ecb35b1ea2f3ea5807d0143bcb /core/src/test/java/org/elasticsearch/search/SearchServiceTests.java
parentb636ca79d579dbef3965b578fa8253aa6189e263 (diff)
Introduce incremental reduction of TopDocs (#23946)
This commit adds support for incremental top N reduction if the number of expected shards in the search request is high enough. The changes here also clean up more code in SearchPhaseController to make the separation between values that are the same on each search result and values that are per response. The reduced search phase result doesn't hold an arbitrary result to obtain values like `from`, `size` or sort values which is now cleanly encapsulated.
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/SearchServiceTests.java')
-rw-r--r--core/src/test/java/org/elasticsearch/search/SearchServiceTests.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/SearchServiceTests.java b/core/src/test/java/org/elasticsearch/search/SearchServiceTests.java
index f3ff6be1cc..6fc795a882 100644
--- a/core/src/test/java/org/elasticsearch/search/SearchServiceTests.java
+++ b/core/src/test/java/org/elasticsearch/search/SearchServiceTests.java
@@ -223,8 +223,13 @@ public class SearchServiceTests extends ESSingleNodeTestCase {
new AliasFilter(null, Strings.EMPTY_ARRAY),
1.0f),
null);
- // the search context should inherit the default timeout
- assertThat(contextWithDefaultTimeout.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
+ try {
+ // the search context should inherit the default timeout
+ assertThat(contextWithDefaultTimeout.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
+ } finally {
+ contextWithDefaultTimeout.decRef();
+ service.freeContext(contextWithDefaultTimeout.id());
+ }
final long seconds = randomIntBetween(6, 10);
final SearchContext context = service.createContext(
@@ -238,8 +243,14 @@ public class SearchServiceTests extends ESSingleNodeTestCase {
new AliasFilter(null, Strings.EMPTY_ARRAY),
1.0f),
null);
- // the search context should inherit the query timeout
- assertThat(context.timeout(), equalTo(TimeValue.timeValueSeconds(seconds)));
+ try {
+ // the search context should inherit the query timeout
+ assertThat(context.timeout(), equalTo(TimeValue.timeValueSeconds(seconds)));
+ } finally {
+ context.decRef();
+ service.freeContext(context.id());
+ }
+
}
public static class FailOnRewriteQueryPlugin extends Plugin implements SearchPlugin {