Add generic assertion to all aggs.bucket tests to check if all shards were successful
This commit is contained in:
parent
36a76cc0ab
commit
1ef349db49
|
@ -40,6 +40,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -90,7 +91,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").field("date").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -125,7 +127,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.order(DateHistogram.Order.KEY_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -148,7 +151,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.order(DateHistogram.Order.KEY_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -171,7 +175,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.order(DateHistogram.Order.COUNT_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -194,7 +199,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.order(DateHistogram.Order.COUNT_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -215,7 +221,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -257,7 +264,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -302,7 +310,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -326,7 +335,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -350,7 +360,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("stats").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -374,7 +385,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("stats").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -397,7 +409,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -439,7 +452,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").field("dates").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -480,7 +494,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.order(DateHistogram.Order.COUNT_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -524,7 +539,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -577,7 +593,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -635,7 +652,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").script("doc['date'].value").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -670,7 +688,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -711,7 +730,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").script("doc['dates'].values").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -761,7 +781,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -813,7 +834,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").field("date").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -829,7 +851,8 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(dateHistogram("histo").field("date").interval(DateHistogram.Interval.MONTH))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateHistogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -109,7 +110,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -154,7 +156,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("2012-03-15"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -200,7 +203,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("2012-03-15"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -245,7 +249,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("2012-02-15||+1M"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -290,7 +295,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("r3", date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -345,7 +351,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -399,7 +406,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(min("min")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -462,7 +470,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -518,7 +527,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -574,7 +584,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -627,7 +638,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -673,7 +685,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -735,7 +748,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -781,7 +795,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(min("min")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -837,7 +852,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -884,7 +900,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("2012-03-15"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -931,7 +948,8 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(date(3, 15)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
DateRange range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -91,7 +92,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -116,7 +118,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_ASC)) // we need to sort by terms cause we're checking the first 20 values
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -140,7 +143,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -165,7 +169,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -190,7 +195,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("values")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -217,7 +223,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -244,7 +251,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("_value + 1"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -267,7 +275,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -295,7 +304,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("_value + 1"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -323,7 +333,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("(long) _value / 1000 + 1"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -363,7 +374,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -397,7 +409,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['value'].value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -421,7 +434,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -447,7 +461,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['values'].values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -499,7 +514,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -535,7 +551,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -552,7 +569,8 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
|
|
@ -40,6 +40,7 @@ import static org.elasticsearch.index.query.FilterBuilders.matchAllFilter;
|
|||
import static org.elasticsearch.index.query.FilterBuilders.termFilter;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -91,7 +92,8 @@ public class FilterTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(filter("tag1").filter(termFilter("tag", "tag1")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Filter filter = response.getAggregations().get("tag1");
|
||||
assertThat(filter, notNullValue());
|
||||
|
@ -107,7 +109,8 @@ public class FilterTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(avg("avg_value").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Filter filter = response.getAggregations().get("tag1");
|
||||
assertThat(filter, notNullValue());
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.Set;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -109,7 +110,8 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(1000))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
GeoDistance geoDist = response.getAggregations().get("amsterdam_rings");
|
||||
assertThat(geoDist, notNullValue());
|
||||
|
@ -150,7 +152,8 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("ring3", 1000))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
GeoDistance geoDist = response.getAggregations().get("amsterdam_rings");
|
||||
assertThat(geoDist, notNullValue());
|
||||
|
@ -193,7 +196,8 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(1000))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
GeoDistance geoDist = response.getAggregations().get("amsterdam_rings");
|
||||
assertThat(geoDist, notNullValue());
|
||||
|
@ -236,7 +240,8 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(1000))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
GeoDistance geoDist = response.getAggregations().get("amsterdam_rings");
|
||||
assertThat(geoDist, notNullValue());
|
||||
|
@ -279,7 +284,8 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(terms("cities").field("city")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
GeoDistance geoDist = response.getAggregations().get("amsterdam_rings");
|
||||
assertThat(geoDist, notNullValue());
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -88,7 +89,8 @@ public class GlobalTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("value_stats").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Global global = response.getAggregations().get("global");
|
||||
assertThat(global, notNullValue());
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
||||
|
@ -107,7 +108,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -128,7 +130,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval).order(Histogram.Order.KEY_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -149,7 +152,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval).order(Histogram.Order.KEY_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -170,7 +174,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval).order(Histogram.Order.COUNT_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -197,7 +202,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval).order(Histogram.Order.COUNT_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -225,7 +231,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -257,7 +264,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -289,7 +297,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -327,7 +336,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -365,7 +375,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("stats")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -403,7 +414,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("stats").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -440,7 +452,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").script("_value + 1").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
final int numBuckets = (numDocs + 1) / interval - 2 / interval + 1;
|
||||
final long[] counts = new long[(numDocs + 1) / interval + 1];
|
||||
|
@ -467,7 +480,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("values").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -488,7 +502,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("values").interval(interval).order(Histogram.Order.KEY_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -509,7 +524,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("values").script("_value + 1").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
final int numBuckets = (numDocs + 2) / interval - 2 / interval + 1;
|
||||
final long[] counts = new long[(numDocs + 2) / interval + 1];
|
||||
|
@ -542,7 +558,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(terms("values").order(Terms.Order.TERM_ASC)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
final int numBuckets = (numDocs + 2) / interval - 2 / interval + 1;
|
||||
final long[] counts = new long[(numDocs + 2) / interval + 1];
|
||||
|
@ -584,7 +601,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").script("doc['value'].value").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -606,7 +624,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -637,7 +656,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").script("doc['values'].values").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -659,7 +679,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -693,7 +714,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
@ -709,7 +731,8 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(histogram("histo").field("value").interval(interval))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Histogram histo = response.getAggregations().get("histo");
|
||||
assertThat(histo, notNullValue());
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -87,7 +88,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -131,7 +133,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addMaskRange("10.0.0.128/25"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -167,7 +170,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("r3", "10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -213,7 +217,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -268,7 +273,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -323,7 +329,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -385,7 +392,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -431,7 +439,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -478,7 +487,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -532,7 +542,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -578,7 +589,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -632,7 +644,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -678,7 +691,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -734,7 +748,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -781,7 +796,8 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("10.0.0.200"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
IPv4Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -37,6 +38,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -88,7 +90,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -113,7 +116,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_ASC)) // we need to sort by terms cause we're checking the first 20 values
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -136,8 +140,7 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value")
|
||||
.order(Terms.Order.TERM_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -162,7 +165,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -187,7 +191,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("values")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -214,7 +219,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -241,7 +247,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("_value + 1"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -264,7 +271,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -292,7 +300,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("_value - 1"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -320,7 +329,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("floor(_value / 1000 + 1)"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -360,7 +370,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -394,7 +405,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['value'].value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -418,7 +430,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -444,7 +457,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['values'].values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -494,7 +508,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -530,7 +545,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -547,7 +563,8 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -98,7 +99,8 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(missing("missing_tag").field("tag"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Missing missing = response.getAggregations().get("missing_tag");
|
||||
assertThat(missing, notNullValue());
|
||||
|
@ -114,7 +116,8 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(missing("missing_tag").field("tag"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Missing missing = response.getAggregations().get("missing_tag");
|
||||
assertThat(missing, notNullValue());
|
||||
|
@ -128,7 +131,8 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(missing("missing_tag").field("tag"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Missing missing = response.getAggregations().get("missing_tag");
|
||||
assertThat(missing, notNullValue());
|
||||
|
@ -143,7 +147,8 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(avg("avg_value").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
assertThat("Not all shards are initialized", response.getSuccessfulShards(), equalTo(response.getTotalShards()));
|
||||
|
||||
Missing missing = response.getAggregations().get("missing_tag");
|
||||
|
@ -173,7 +178,8 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(missing("sub_missing")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Missing topMissing = response.getAggregations().get("top_missing");
|
||||
assertThat(topMissing, notNullValue());
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -106,7 +107,8 @@ public class NestedTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(stats("nested_value_stats").field("nested.value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
|
@ -160,7 +162,8 @@ public class NestedTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(terms("values").field("nested.value").size(100)))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
long docCount = 0;
|
||||
long[] counts = new long[numParents + 6];
|
||||
|
@ -209,7 +212,8 @@ public class NestedTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(max("max_value").field("nested.value"))))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
LongTerms values = response.getAggregations().get("top_values");
|
||||
assertThat(values, notNullValue());
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -85,7 +86,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -124,7 +126,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom("r3", 6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -164,7 +167,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum").field("value")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -217,7 +221,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(avg("avg")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -270,7 +275,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -322,7 +328,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -375,7 +382,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -433,7 +441,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -488,7 +497,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -528,7 +538,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(avg("avg")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -579,7 +590,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(1000))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -611,7 +623,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -668,7 +681,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(sum("sum")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -725,7 +739,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -766,7 +781,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(6))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
@ -806,7 +822,8 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
.addUnboundedFrom(4))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
|
||||
Range range = response.getAggregations().get("range");
|
||||
assertThat(range, notNullValue());
|
||||
|
|
|
@ -39,6 +39,7 @@ import java.util.regex.Pattern;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -90,7 +91,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -116,7 +117,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").include("val00.+"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -138,7 +139,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").include("val00.+").exclude("(val000|val001)"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -160,7 +161,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").exclude("val0[1-9]+.+"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -187,7 +188,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").include("VAL00.+", Pattern.CASE_INSENSITIVE))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -210,7 +211,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").include("val00.+").exclude("( val000 | VAL001 )#this is a comment", Pattern.CASE_INSENSITIVE | Pattern.COMMENTS))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -233,7 +234,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value").exclude("val0[1-9]+.+", 0))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -258,7 +259,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_ASC)) // we need to sort by terms cause we're checking the first 20 values
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -281,7 +282,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_ASC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -305,7 +306,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.order(Terms.Order.TERM_DESC))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -329,7 +330,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(count("count").field("values")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -355,7 +356,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(count("count")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -381,7 +382,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("'foo_' + _value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -404,7 +405,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("_value.substring(0,3)"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -424,7 +425,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -451,7 +452,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("'foo_' + _value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -497,7 +498,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(count("count")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -529,7 +530,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['value'].value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -551,7 +552,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['value'].value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -574,7 +575,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(count("count")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -599,7 +600,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.script("doc['values'].values"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -626,7 +627,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.subAggregation(count("count")))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -660,7 +661,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
@ -677,7 +678,7 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field("value"))
|
||||
.execute().actionGet();
|
||||
|
||||
assertThat(response.getFailedShards(), equalTo(0));
|
||||
assertSearchResponse(response);
|
||||
|
||||
Terms terms = response.getAggregations().get("terms");
|
||||
assertThat(terms, notNullValue());
|
||||
|
|
|
@ -34,6 +34,8 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuild
|
|||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
|
||||
import org.elasticsearch.action.count.CountResponse;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.ShardSearchFailure;
|
||||
import org.elasticsearch.action.support.broadcast.BroadcastOperationResponse;
|
||||
|
@ -376,4 +378,21 @@ public class ElasticsearchAssertions {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if
|
||||
* any of the shards threw an exception and if the response is serializeable.
|
||||
*/
|
||||
public static SearchResponse assertSearchResponse(SearchRequestBuilder request) {
|
||||
return assertSearchResponse(request.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies basic assertions on the SearchResponse. This method checks if all shards were successful, if
|
||||
* any of the shards threw an exception and if the response is serializeable.
|
||||
*/
|
||||
public static SearchResponse assertSearchResponse(SearchResponse response) {
|
||||
assertNoFailures(response);
|
||||
assertThat("One or more shards were not successful but didn't trigger a failure", response.getSuccessfulShards(), equalTo(response.getTotalShards()));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue