Test: make field `id` is defined in mapping, so sort can't fail
This commit is contained in:
parent
29613d90d3
commit
4111d932f6
|
@ -2194,7 +2194,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertHitCount(searchResponse, 2l);
|
||||
}
|
||||
|
||||
List<IndexRequestBuilder> createMinMaxDocBuilders() {
|
||||
private List<IndexRequestBuilder> createMinMaxDocBuilders() {
|
||||
List<IndexRequestBuilder> indexBuilders = new ArrayList<>();
|
||||
// Parent 1 and its children
|
||||
indexBuilders.add(client().prepareIndex().setType("parent").setId("1").setIndex("test").setSource("id",1));
|
||||
|
@ -2231,7 +2231,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
return indexBuilders;
|
||||
}
|
||||
|
||||
SearchResponse MinMaxQuery(String scoreType, int minChildren, int maxChildren, int cutoff) throws SearchPhaseExecutionException {
|
||||
private SearchResponse minMaxQuery(String scoreType, int minChildren, int maxChildren, int cutoff) throws SearchPhaseExecutionException {
|
||||
return client()
|
||||
.prepareSearch("test")
|
||||
.setQuery(
|
||||
|
@ -2246,7 +2246,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
.addSort("_score", SortOrder.DESC).addSort("id", SortOrder.ASC).get();
|
||||
}
|
||||
|
||||
SearchResponse MinMaxFilter( int minChildren, int maxChildren, int cutoff) throws SearchPhaseExecutionException {
|
||||
private SearchResponse minMaxFilter(int minChildren, int maxChildren, int cutoff) throws SearchPhaseExecutionException {
|
||||
return client()
|
||||
.prepareSearch("test")
|
||||
.setQuery(
|
||||
|
@ -2255,10 +2255,11 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
.addSort("id", SortOrder.ASC).setTrackScores(true).get();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMinMaxChildren() throws Exception {
|
||||
assertAcked(prepareCreate("test").addMapping("parent").addMapping("child", "_parent", "type=parent"));
|
||||
assertAcked(prepareCreate("test")
|
||||
.addMapping("parent", "id", "type=long")
|
||||
.addMapping("child", "_parent", "type=parent"));
|
||||
ensureGreen();
|
||||
|
||||
indexRandom(true, createMinMaxDocBuilders().toArray(new IndexRequestBuilder[0]));
|
||||
|
@ -2266,7 +2267,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
int cutoff = getRandom().nextInt(4);
|
||||
|
||||
// Score mode = NONE
|
||||
response = MinMaxQuery("none", 0, 0, cutoff);
|
||||
response = minMaxQuery("none", 0, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2276,7 +2277,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 1, 0, cutoff);
|
||||
response = minMaxQuery("none", 1, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2286,7 +2287,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 2, 0, cutoff);
|
||||
response = minMaxQuery("none", 2, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
|
@ -2294,17 +2295,17 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 3, 0, cutoff);
|
||||
response = minMaxQuery("none", 3, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 4, 0, cutoff);
|
||||
response = minMaxQuery("none", 4, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(0l));
|
||||
|
||||
response = MinMaxQuery("none", 0, 4, cutoff);
|
||||
response = minMaxQuery("none", 0, 4, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2314,7 +2315,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 0, 3, cutoff);
|
||||
response = minMaxQuery("none", 0, 3, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2324,7 +2325,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 0, 2, cutoff);
|
||||
response = minMaxQuery("none", 0, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2332,21 +2333,21 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("none", 2, 2, cutoff);
|
||||
response = minMaxQuery("none", 2, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(1f));
|
||||
|
||||
try {
|
||||
response = MinMaxQuery("none", 3, 2, cutoff);
|
||||
response = minMaxQuery("none", 3, 2, cutoff);
|
||||
fail();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
assertThat(e.getMessage(), containsString("[has_child] 'max_children' is less than 'min_children'"));
|
||||
}
|
||||
|
||||
// Score mode = SUM
|
||||
response = MinMaxQuery("sum", 0, 0, cutoff);
|
||||
response = minMaxQuery("sum", 0, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2356,7 +2357,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("sum", 1, 0, cutoff);
|
||||
response = minMaxQuery("sum", 1, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2366,7 +2367,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("sum", 2, 0, cutoff);
|
||||
response = minMaxQuery("sum", 2, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2374,17 +2375,17 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(3f));
|
||||
|
||||
response = MinMaxQuery("sum", 3, 0, cutoff);
|
||||
response = minMaxQuery("sum", 3, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(6f));
|
||||
|
||||
response = MinMaxQuery("sum", 4, 0, cutoff);
|
||||
response = minMaxQuery("sum", 4, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(0l));
|
||||
|
||||
response = MinMaxQuery("sum", 0, 4, cutoff);
|
||||
response = minMaxQuery("sum", 0, 4, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2394,7 +2395,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("sum", 0, 3, cutoff);
|
||||
response = minMaxQuery("sum", 0, 3, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2404,7 +2405,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("sum", 0, 2, cutoff);
|
||||
response = minMaxQuery("sum", 0, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
|
@ -2412,21 +2413,21 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("sum", 2, 2, cutoff);
|
||||
response = minMaxQuery("sum", 2, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(3f));
|
||||
|
||||
try {
|
||||
response = MinMaxQuery("sum", 3, 2, cutoff);
|
||||
response = minMaxQuery("sum", 3, 2, cutoff);
|
||||
fail();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
assertThat(e.getMessage(), containsString("[has_child] 'max_children' is less than 'min_children'"));
|
||||
}
|
||||
|
||||
// Score mode = MAX
|
||||
response = MinMaxQuery("max", 0, 0, cutoff);
|
||||
response = minMaxQuery("max", 0, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2436,7 +2437,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("max", 1, 0, cutoff);
|
||||
response = minMaxQuery("max", 1, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2446,7 +2447,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("max", 2, 0, cutoff);
|
||||
response = minMaxQuery("max", 2, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2454,17 +2455,17 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(2f));
|
||||
|
||||
response = MinMaxQuery("max", 3, 0, cutoff);
|
||||
response = minMaxQuery("max", 3, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(3f));
|
||||
|
||||
response = MinMaxQuery("max", 4, 0, cutoff);
|
||||
response = minMaxQuery("max", 4, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(0l));
|
||||
|
||||
response = MinMaxQuery("max", 0, 4, cutoff);
|
||||
response = minMaxQuery("max", 0, 4, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2474,7 +2475,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("max", 0, 3, cutoff);
|
||||
response = minMaxQuery("max", 0, 3, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2484,7 +2485,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("max", 0, 2, cutoff);
|
||||
response = minMaxQuery("max", 0, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
|
@ -2492,21 +2493,21 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("max", 2, 2, cutoff);
|
||||
response = minMaxQuery("max", 2, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(2f));
|
||||
|
||||
try {
|
||||
response = MinMaxQuery("max", 3, 2, cutoff);
|
||||
response = minMaxQuery("max", 3, 2, cutoff);
|
||||
fail();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
assertThat(e.getMessage(), containsString("[has_child] 'max_children' is less than 'min_children'"));
|
||||
}
|
||||
|
||||
// Score mode = AVG
|
||||
response = MinMaxQuery("avg", 0, 0, cutoff);
|
||||
response = minMaxQuery("avg", 0, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2516,7 +2517,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("avg", 1, 0, cutoff);
|
||||
response = minMaxQuery("avg", 1, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2526,7 +2527,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("avg", 2, 0, cutoff);
|
||||
response = minMaxQuery("avg", 2, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2534,17 +2535,17 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1.5f));
|
||||
|
||||
response = MinMaxQuery("avg", 3, 0, cutoff);
|
||||
response = minMaxQuery("avg", 3, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(2f));
|
||||
|
||||
response = MinMaxQuery("avg", 4, 0, cutoff);
|
||||
response = minMaxQuery("avg", 4, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(0l));
|
||||
|
||||
response = MinMaxQuery("avg", 0, 4, cutoff);
|
||||
response = minMaxQuery("avg", 0, 4, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2554,7 +2555,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("avg", 0, 3, cutoff);
|
||||
response = minMaxQuery("avg", 0, 3, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
|
@ -2564,7 +2565,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("avg", 0, 2, cutoff);
|
||||
response = minMaxQuery("avg", 0, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
|
@ -2572,21 +2573,21 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("2"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxQuery("avg", 2, 2, cutoff);
|
||||
response = minMaxQuery("avg", 2, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(1.5f));
|
||||
|
||||
try {
|
||||
response = MinMaxQuery("avg", 3, 2, cutoff);
|
||||
response = minMaxQuery("avg", 3, 2, cutoff);
|
||||
fail();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
assertThat(e.getMessage(), containsString("[has_child] 'max_children' is less than 'min_children'"));
|
||||
}
|
||||
|
||||
// HasChildFilter
|
||||
response = MinMaxFilter(0, 0, cutoff);
|
||||
response = minMaxFilter(0, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2596,7 +2597,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(1, 0, cutoff);
|
||||
response = minMaxFilter(1, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2606,7 +2607,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(2, 0, cutoff);
|
||||
response = minMaxFilter(2, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
|
@ -2614,17 +2615,17 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(3, 0, cutoff);
|
||||
response = minMaxFilter(3, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(4, 0, cutoff);
|
||||
response = minMaxFilter(4, 0, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(0l));
|
||||
|
||||
response = MinMaxFilter(0, 4, cutoff);
|
||||
response = minMaxFilter(0, 4, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2634,7 +2635,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(0, 3, cutoff);
|
||||
response = minMaxFilter(0, 3, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(3l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2644,7 +2645,7 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[2].id(), equalTo("4"));
|
||||
assertThat(response.getHits().hits()[2].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(0, 2, cutoff);
|
||||
response = minMaxFilter(0, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("2"));
|
||||
|
@ -2652,14 +2653,14 @@ public class SimpleChildQuerySearchTests extends ElasticsearchIntegrationTest {
|
|||
assertThat(response.getHits().hits()[1].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[1].score(), equalTo(1f));
|
||||
|
||||
response = MinMaxFilter(2, 2, cutoff);
|
||||
response = minMaxFilter(2, 2, cutoff);
|
||||
|
||||
assertThat(response.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(response.getHits().hits()[0].id(), equalTo("3"));
|
||||
assertThat(response.getHits().hits()[0].score(), equalTo(1f));
|
||||
|
||||
try {
|
||||
response = MinMaxFilter(3, 2, cutoff);
|
||||
response = minMaxFilter(3, 2, cutoff);
|
||||
fail();
|
||||
} catch (SearchPhaseExecutionException e) {
|
||||
assertThat(e.getMessage(), containsString("[has_child] 'max_children' is less than 'min_children'"));
|
||||
|
|
Loading…
Reference in New Issue