summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/aggregations/bucket
diff options
context:
space:
mode:
authorSimon Willnauer <simonw@apache.org>2017-02-14 12:34:25 +0100
committerGitHub <noreply@github.com>2017-02-14 12:34:25 +0100
commitaef0665ddbb9745de5548c3a057828427461c825 (patch)
tree01743da230c8b478520f63ae15788e1564d64b6b /core/src/test/java/org/elasticsearch/search/aggregations/bucket
parent5b459a0bdcb05e20d9d0cc0a0326f6fa5d0994c3 (diff)
Detach SearchPhases from AbstractSearchAsyncAction (#23118)
Today all search phases are inner classes of AbstractSearchAsyncAction or one of it's subclasses. This makes unit testing of these classes practically impossible. This commit Extracts `DfsQueryPhase` and `FetchSearchPhase` or of the code that composes the actual query execution types and moves most of the fan-out and collect code into an `InitialSearchPhase` class that can be used to build initial search phases (phases that retry on shards). This will make modification to these classes simpler and allows to easily compose or add new search phases down the road if additional roundtrips are required.
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/bucket')
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java
index e02ada02b5..ff02c6a2cc 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/AdjacencyMatrixIT.java
@@ -70,7 +70,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
.setSettings(
Settings.builder().put(IndexSettings.MAX_ADJACENCY_MATRIX_FILTERS_SETTING.getKey(), MAX_NUM_FILTERS))
.get());
-
+
numDocs = randomIntBetween(5, 20);
numTag1Docs = randomIntBetween(1, numDocs - 1);
numTag2Docs = randomIntBetween(1, numDocs - numTag1Docs);
@@ -165,7 +165,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
}
}
-
+
// See NullPointer issue when filters are empty:
// https://github.com/elastic/elasticsearch/issues/8438
@@ -196,7 +196,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
.addAggregation(
adjacencyMatrix("tags",
newMap("tag1", termQuery("tag", "tag1"))
- .add("tag2", termQuery("tag", "tag2"))
+ .add("tag2", termQuery("tag", "tag2"))
.add("both", boolQ))
.subAggregation(avg("avg_value").field("value")))
.execute().actionGet();
@@ -215,7 +215,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
expectedBuckets ++;
}
if (numMultiTagDocs > 0) {
- // both, both&tag1, both&tag2, tag1&tag2
+ // both, both&tag1, both&tag2, tag1&tag2
expectedBuckets += 4;
}
@@ -283,7 +283,7 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
assertThat(bucketBothQ, Matchers.notNullValue());
assertThat(bucketBothQ.getDocCount(), equalTo((long) numMultiTagDocs));
Avg avgValueBothQ = bucketBothQ.getAggregations().get("avg_value");
-
+
Bucket bucketIntersectQ = matrix.getBucketByKey("tag1&tag2");
assertThat(bucketIntersectQ, Matchers.notNullValue());
assertThat(bucketIntersectQ.getDocCount(), equalTo((long) numMultiTagDocs));
@@ -299,23 +299,23 @@ public class AdjacencyMatrixIT extends ESIntegTestCase {
}
-
+
public void testTooLargeMatrix() throws Exception{
-
- // Create more filters than is permitted by index settings.
+
+ // Create more filters than is permitted by index settings.
MapBuilder filtersMap = new MapBuilder();
for (int i = 0; i <= MAX_NUM_FILTERS; i++) {
filtersMap.add("tag" + i, termQuery("tag", "tag" + i));
}
-
+
try {
client().prepareSearch("idx")
.addAggregation(adjacencyMatrix("tags", "\t", filtersMap))
.execute().actionGet();
fail("SearchPhaseExecutionException should have been thrown");
} catch (SearchPhaseExecutionException ex) {
- assertThat(ex.getCause().getCause().getMessage(), containsString("Number of filters is too large"));
- }
+ assertThat(ex.getCause().getMessage(), containsString("Number of filters is too large"));
+ }
}
public void testAsSubAggregation() {