mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
Remove more explicit references to SearchResponse in tests (#101092)
Remove `assertSearchResponse` which was just an alias for `assertNoFailures` and then cleanup many spots in the result by combining the hit count and no failure assertion into a single method. follow-up to #100966
This commit is contained in:
parent
c1aa78bcab
commit
ca6295e582
94 changed files with 788 additions and 861 deletions
|
@ -35,7 +35,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -102,7 +102,7 @@ public class AdjacencyMatrixIT extends AggregationIntegTestCase {
|
||||||
.addAggregation(adjacencyMatrix("tags", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2"))))
|
.addAggregation(adjacencyMatrix("tags", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2"))))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
||||||
assertThat(matrix, notNullValue());
|
assertThat(matrix, notNullValue());
|
||||||
|
@ -134,7 +134,7 @@ public class AdjacencyMatrixIT extends AggregationIntegTestCase {
|
||||||
.addAggregation(adjacencyMatrix("tags", "\t", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2"))))
|
.addAggregation(adjacencyMatrix("tags", "\t", newMap("tag1", termQuery("tag", "tag1")).add("tag2", termQuery("tag", "tag2"))))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
||||||
assertThat(matrix, notNullValue());
|
assertThat(matrix, notNullValue());
|
||||||
|
@ -157,7 +157,7 @@ public class AdjacencyMatrixIT extends AggregationIntegTestCase {
|
||||||
.addAggregation(adjacencyMatrix("tags", newMap("all", emptyFilter).add("tag1", termQuery("tag", "tag1"))))
|
.addAggregation(adjacencyMatrix("tags", newMap("all", emptyFilter).add("tag1", termQuery("tag", "tag1"))))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
AdjacencyMatrix filters = response.getAggregations().get("tags");
|
AdjacencyMatrix filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -180,7 +180,7 @@ public class AdjacencyMatrixIT extends AggregationIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
AdjacencyMatrix matrix = response.getAggregations().get("tags");
|
||||||
assertThat(matrix, notNullValue());
|
assertThat(matrix, notNullValue());
|
||||||
|
@ -309,7 +309,7 @@ public class AdjacencyMatrixIT extends AggregationIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
|
|
@ -58,7 +58,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -178,7 +177,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
|
|
||||||
public void testStandAloneTimeSeriesAgg() {
|
public void testStandAloneTimeSeriesAgg() {
|
||||||
SearchResponse response = client().prepareSearch("index").setSize(0).addAggregation(timeSeries("by_ts")).get();
|
SearchResponse response = client().prepareSearch("index").setSize(0).addAggregation(timeSeries("by_ts")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
||||||
|
@ -204,7 +203,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
.subAggregation(timeSeries("by_ts"))
|
.subAggregation(timeSeries("by_ts"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
Terms terms = aggregations.get("by_dim");
|
Terms terms = aggregations.get("by_dim");
|
||||||
|
@ -232,7 +231,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
.subAggregation(timeSeries("by_ts").subAggregation(stats("timestamp").field("@timestamp")))
|
.subAggregation(timeSeries("by_ts").subAggregation(stats("timestamp").field("@timestamp")))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
Histogram histogram = aggregations.get("by_time");
|
Histogram histogram = aggregations.get("by_time");
|
||||||
|
@ -272,7 +271,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(timeSeries("by_ts"))
|
.addAggregation(timeSeries("by_ts"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
||||||
|
@ -304,7 +303,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
.addAggregation(global("everything").subAggregation(sum("all_sum").field("metric_" + metric)))
|
.addAggregation(global("everything").subAggregation(sum("all_sum").field("metric_" + metric)))
|
||||||
.addAggregation(PipelineAggregatorBuilders.sumBucket("total_filter_sum", "by_ts>filter_sum"))
|
.addAggregation(PipelineAggregatorBuilders.sumBucket("total_filter_sum", "by_ts>filter_sum"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
||||||
|
@ -351,7 +350,7 @@ public class TimeSeriesAggregationsIT extends AggregationIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(timeSeries("by_ts"))
|
.addAggregation(timeSeries("by_ts"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
InternalTimeSeries timeSeries = aggregations.get("by_ts");
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHistogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHistogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -125,7 +125,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -170,7 +170,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -235,7 +235,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -293,7 +293,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -353,7 +353,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -421,7 +421,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -504,7 +504,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -562,7 +562,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -580,7 +580,7 @@ public class DateDerivativeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
|
|
@ -31,7 +31,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.histogra
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.min;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.min;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.diff;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.diff;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -231,7 +231,7 @@ public class SerialDiffIT extends AggregationIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
|
|
@ -44,7 +44,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.bucketScript;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.bucketScript;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -88,7 +87,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
ensureGreen("test");
|
ensureGreen("test");
|
||||||
client().prepareIndex("test").setId("1").setSource("foo", 4).setRefreshPolicy(IMMEDIATE).get();
|
client().prepareIndex("test").setId("1").setSource("foo", 4).setRefreshPolicy(IMMEDIATE).get();
|
||||||
SearchResponse rsp = buildRequest("doc['foo'] + abs(1)").get();
|
SearchResponse rsp = buildRequest("doc['foo'] + abs(1)").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +117,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
req.setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("text", "hello"), score).boostMode(CombineFunction.REPLACE));
|
req.setQuery(QueryBuilders.functionScoreQuery(QueryBuilders.termQuery("text", "hello"), score).boostMode(CombineFunction.REPLACE));
|
||||||
req.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); // make sure DF is consistent
|
req.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); // make sure DF is consistent
|
||||||
SearchResponse rsp = req.get();
|
SearchResponse rsp = req.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
SearchHits hits = rsp.getHits();
|
SearchHits hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals("1", hits.getAt(0).getId());
|
assertEquals("1", hits.getAt(0).getId());
|
||||||
|
@ -223,7 +222,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
SearchResponse rsp = buildRequest("doc['double0'].count() + doc['double1'].count()").get();
|
SearchResponse rsp = buildRequest("doc['double0'].count() + doc['double1'].count()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
SearchHits hits = rsp.getHits();
|
SearchHits hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -231,7 +230,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].sum()").get();
|
rsp = buildRequest("doc['double0'].sum()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(7.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(7.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -239,7 +238,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(6.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(6.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].avg() + doc['double1'].avg()").get();
|
rsp = buildRequest("doc['double0'].avg() + doc['double1'].avg()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(4.3, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(4.3, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -247,7 +246,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(5.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(5.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].median()").get();
|
rsp = buildRequest("doc['double0'].median()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(1.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(1.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -255,7 +254,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(1.25, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(1.25, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].min()").get();
|
rsp = buildRequest("doc['double0'].min()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -263,7 +262,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(-1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(-1.5, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].max()").get();
|
rsp = buildRequest("doc['double0'].max()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -271,7 +270,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, hits.getAt(2).field("foo").getValue(), 0.0D);
|
||||||
|
|
||||||
rsp = buildRequest("doc['double0'].sum()/doc['double0'].count()").get();
|
rsp = buildRequest("doc['double0'].sum()/doc['double0'].count()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(2.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(2.5, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -280,7 +279,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// make sure count() works for missing
|
// make sure count() works for missing
|
||||||
rsp = buildRequest("doc['double2'].count()").get();
|
rsp = buildRequest("doc['double2'].count()").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(1.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -289,7 +288,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// make sure .empty works in the same way
|
// make sure .empty works in the same way
|
||||||
rsp = buildRequest("doc['double2'].empty ? 5.0 : 2.0").get();
|
rsp = buildRequest("doc['double2'].empty ? 5.0 : 2.0").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
hits = rsp.getHits();
|
hits = rsp.getHits();
|
||||||
assertEquals(3, hits.getTotalHits().value);
|
assertEquals(3, hits.getTotalHits().value);
|
||||||
assertEquals(2.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(2.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -327,7 +326,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
client().prepareIndex("test").setId("2").setSource("id", 2, "y", 2)
|
client().prepareIndex("test").setId("2").setSource("id", 2, "y", 2)
|
||||||
);
|
);
|
||||||
SearchResponse rsp = buildRequest("doc['x'] + 1").get();
|
SearchResponse rsp = buildRequest("doc['x'] + 1").get();
|
||||||
ElasticsearchAssertions.assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
SearchHits hits = rsp.getHits();
|
SearchHits hits = rsp.getHits();
|
||||||
assertEquals(2, rsp.getHits().getTotalHits().value);
|
assertEquals(2, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(5.0, hits.getAt(0).field("foo").getValue(), 0.0D);
|
||||||
|
@ -640,22 +639,22 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
refresh();
|
refresh();
|
||||||
// access .lat
|
// access .lat
|
||||||
SearchResponse rsp = buildRequest("doc['location'].lat").get();
|
SearchResponse rsp = buildRequest("doc['location'].lat").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(61.5240, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(61.5240, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
// access .lon
|
// access .lon
|
||||||
rsp = buildRequest("doc['location'].lon").get();
|
rsp = buildRequest("doc['location'].lon").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(105.3188, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(105.3188, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
// access .empty
|
// access .empty
|
||||||
rsp = buildRequest("doc['location'].empty ? 1 : 0").get();
|
rsp = buildRequest("doc['location'].empty ? 1 : 0").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(0, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(0, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
// call haversin
|
// call haversin
|
||||||
rsp = buildRequest("haversin(38.9072, 77.0369, doc['location'].lat, doc['location'].lon)").get();
|
rsp = buildRequest("haversin(38.9072, 77.0369, doc['location'].lat, doc['location'].lon)").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(3170D, rsp.getHits().getAt(0).field("foo").getValue(), 50D);
|
assertEquals(3170D, rsp.getHits().getAt(0).field("foo").getValue(), 50D);
|
||||||
}
|
}
|
||||||
|
@ -678,14 +677,14 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
// access .value
|
// access .value
|
||||||
SearchResponse rsp = buildRequest("doc['vip'].value").get();
|
SearchResponse rsp = buildRequest("doc['vip'].value").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(3, rsp.getHits().getTotalHits().value);
|
assertEquals(3, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(1.0D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(1.0D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
assertEquals(0.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
assertEquals(0.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
||||||
assertEquals(0.0D, rsp.getHits().getAt(2).field("foo").getValue(), 1.0D);
|
assertEquals(0.0D, rsp.getHits().getAt(2).field("foo").getValue(), 1.0D);
|
||||||
// access .empty
|
// access .empty
|
||||||
rsp = buildRequest("doc['vip'].empty ? 1 : 0").get();
|
rsp = buildRequest("doc['vip'].empty ? 1 : 0").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(3, rsp.getHits().getTotalHits().value);
|
assertEquals(3, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(0.0D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(0.0D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
assertEquals(0.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
assertEquals(0.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
||||||
|
@ -693,7 +692,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
// ternary operator
|
// ternary operator
|
||||||
// vip's have a 50% discount
|
// vip's have a 50% discount
|
||||||
rsp = buildRequest("doc['vip'] ? doc['price']/2 : doc['price']").get();
|
rsp = buildRequest("doc['vip'] ? doc['price']/2 : doc['price']").get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(3, rsp.getHits().getTotalHits().value);
|
assertEquals(3, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(0.5D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
assertEquals(0.5D, rsp.getHits().getAt(0).field("foo").getValue(), 1.0D);
|
||||||
assertEquals(2.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
assertEquals(2.0D, rsp.getHits().getAt(1).field("foo").getValue(), 1.0D);
|
||||||
|
@ -712,7 +711,7 @@ public class MoreExpressionIT extends ESIntegTestCase {
|
||||||
Script script = new Script(ScriptType.INLINE, "expression", "doc['foo'].value", Collections.emptyMap());
|
Script script = new Script(ScriptType.INLINE, "expression", "doc['foo'].value", Collections.emptyMap());
|
||||||
builder.setQuery(QueryBuilders.boolQuery().filter(QueryBuilders.scriptQuery(script)));
|
builder.setQuery(QueryBuilders.boolQuery().filter(QueryBuilders.scriptQuery(script)));
|
||||||
SearchResponse rsp = builder.get();
|
SearchResponse rsp = builder.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
assertEquals(1, rsp.getHits().getTotalHits().value);
|
assertEquals(1, rsp.getHits().getTotalHits().value);
|
||||||
assertEquals(1.0D, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
assertEquals(1.0D, rsp.getHits().getAt(0).field("foo").getValue(), 0.0D);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -50,7 +49,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
.addAggregation(children("to_comment", "comment"));
|
.addAggregation(children("to_comment", "comment"));
|
||||||
final SearchResponse searchResponse = searchRequest.get();
|
final SearchResponse searchResponse = searchRequest.get();
|
||||||
long count = categoryToControl.values().stream().mapToLong(control -> control.commentIds.size()).sum();
|
long count = categoryToControl.values().stream().mapToLong(control -> control.commentIds.size()).sum();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
Children childrenAgg = searchResponse.getAggregations().get("to_comment");
|
Children childrenAgg = searchResponse.getAggregations().get("to_comment");
|
||||||
assertThat("Request: " + searchRequest + "\nResponse: " + searchResponse + "\n", childrenAgg.getDocCount(), equalTo(count));
|
assertThat("Request: " + searchRequest + "\nResponse: " + searchResponse + "\n", childrenAgg.getDocCount(), equalTo(count));
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Terms categoryTerms = searchResponse.getAggregations().get("category");
|
Terms categoryTerms = searchResponse.getAggregations().get("category");
|
||||||
assertThat(categoryTerms.getBuckets().size(), equalTo(categoryToControl.size()));
|
assertThat(categoryTerms.getBuckets().size(), equalTo(categoryToControl.size()));
|
||||||
|
@ -107,7 +106,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
.subAggregation(children("to_comment", "comment").subAggregation(topHits("top_comments").sort("id", SortOrder.ASC)))
|
.subAggregation(children("to_comment", "comment").subAggregation(topHits("top_comments").sort("id", SortOrder.ASC)))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Terms categoryTerms = searchResponse.getAggregations().get("category");
|
Terms categoryTerms = searchResponse.getAggregations().get("category");
|
||||||
assertThat(categoryTerms.getBuckets().size(), equalTo(3));
|
assertThat(categoryTerms.getBuckets().size(), equalTo(3));
|
||||||
|
@ -204,7 +203,7 @@ public class ChildrenIT extends AbstractParentChildTestCase {
|
||||||
|
|
||||||
public void testNonExistingChildType() throws Exception {
|
public void testNonExistingChildType() throws Exception {
|
||||||
SearchResponse searchResponse = client().prepareSearch("test").addAggregation(children("non-existing", "xyz")).get();
|
SearchResponse searchResponse = client().prepareSearch("test").addAggregation(children("non-existing", "xyz")).get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Children children = searchResponse.getAggregations().get("non-existing");
|
Children children = searchResponse.getAggregations().get("non-existing");
|
||||||
assertThat(children.getName(), equalTo("non-existing"));
|
assertThat(children.getName(), equalTo("non-existing"));
|
||||||
|
|
|
@ -27,7 +27,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
||||||
import static org.elasticsearch.join.aggregations.JoinAggregationBuilders.parent;
|
import static org.elasticsearch.join.aggregations.JoinAggregationBuilders.parent;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class ParentIT extends AbstractParentChildTestCase {
|
public class ParentIT extends AbstractParentChildTestCase {
|
||||||
|
@ -39,7 +39,7 @@ public class ParentIT extends AbstractParentChildTestCase {
|
||||||
.addAggregation(parent("to_article", "comment"));
|
.addAggregation(parent("to_article", "comment"));
|
||||||
SearchResponse searchResponse = searchRequest.get();
|
SearchResponse searchResponse = searchRequest.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
long articlesWithComment = articleToControl.values()
|
long articlesWithComment = articleToControl.values()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(parentControl -> parentControl.commentIds.isEmpty() == false)
|
.filter(parentControl -> parentControl.commentIds.isEmpty() == false)
|
||||||
|
@ -58,7 +58,7 @@ public class ParentIT extends AbstractParentChildTestCase {
|
||||||
.setQuery(matchQuery("randomized", true))
|
.setQuery(matchQuery("randomized", true))
|
||||||
.addAggregation(parent("to_article", "comment").subAggregation(terms("category").field("category").size(10000)));
|
.addAggregation(parent("to_article", "comment").subAggregation(terms("category").field("category").size(10000)));
|
||||||
SearchResponse searchResponse = searchRequest.get();
|
SearchResponse searchResponse = searchRequest.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
long articlesWithComment = articleToControl.values()
|
long articlesWithComment = articleToControl.values()
|
||||||
.stream()
|
.stream()
|
||||||
|
@ -121,7 +121,7 @@ public class ParentIT extends AbstractParentChildTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
SearchResponse searchResponse = searchRequest.get();
|
SearchResponse searchResponse = searchRequest.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
final Set<String> commenters = getCommenters();
|
final Set<String> commenters = getCommenters();
|
||||||
final Map<String, Set<String>> commenterToComments = getCommenterToComments();
|
final Map<String, Set<String>> commenterToComments = getCommenterToComments();
|
||||||
|
@ -201,7 +201,7 @@ public class ParentIT extends AbstractParentChildTestCase {
|
||||||
|
|
||||||
public void testNonExistingParentType() throws Exception {
|
public void testNonExistingParentType() throws Exception {
|
||||||
SearchResponse searchResponse = client().prepareSearch("test").addAggregation(parent("non-existing", "xyz")).get();
|
SearchResponse searchResponse = client().prepareSearch("test").addAggregation(parent("non-existing", "xyz")).get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Parent parent = searchResponse.getAggregations().get("non-existing");
|
Parent parent = searchResponse.getAggregations().get("non-existing");
|
||||||
assertThat(parent.getName(), equalTo("non-existing"));
|
assertThat(parent.getName(), equalTo("non-existing"));
|
||||||
|
@ -218,7 +218,7 @@ public class ParentIT extends AbstractParentChildTestCase {
|
||||||
.subAggregation(parent("to_article", "comment").subAggregation(terms("to_category").field("category").size(10000)))
|
.subAggregation(parent("to_article", "comment").subAggregation(terms("to_category").field("category").size(10000)))
|
||||||
);
|
);
|
||||||
SearchResponse searchResponse = searchRequest.get();
|
SearchResponse searchResponse = searchRequest.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
final Set<String> commenters = getCommenters();
|
final Set<String> commenters = getCommenters();
|
||||||
final Map<String, Set<String>> commenterToComments = getCommenterToComments();
|
final Map<String, Set<String>> commenterToComments = getCommenterToComments();
|
||||||
|
|
|
@ -52,6 +52,7 @@ import static org.elasticsearch.join.query.JoinQueryBuilders.hasChildQuery;
|
||||||
import static org.elasticsearch.join.query.JoinQueryBuilders.hasParentQuery;
|
import static org.elasticsearch.join.query.JoinQueryBuilders.hasParentQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
||||||
|
@ -638,15 +639,14 @@ public class InnerHitsIT extends ParentChildTestCase {
|
||||||
createIndexRequest("index1", "parent_type", "1", null, "nested_type", Collections.singletonMap("key", "value")).get();
|
createIndexRequest("index1", "parent_type", "1", null, "nested_type", Collections.singletonMap("key", "value")).get();
|
||||||
createIndexRequest("index1", "child_type", "2", "1").get();
|
createIndexRequest("index1", "child_type", "2", "1").get();
|
||||||
refresh();
|
refresh();
|
||||||
|
assertHitCountAndNoFailures(
|
||||||
SearchResponse response = client().prepareSearch("index1")
|
client().prepareSearch("index1")
|
||||||
.setQuery(
|
.setQuery(
|
||||||
hasChildQuery("child_type", matchAllQuery(), ScoreMode.None).ignoreUnmapped(true)
|
hasChildQuery("child_type", matchAllQuery(), ScoreMode.None).ignoreUnmapped(true)
|
||||||
.innerHit(new InnerHitBuilder().setFrom(50).setSize(10).setName("_name"))
|
.innerHit(new InnerHitBuilder().setFrom(50).setSize(10).setName("_name"))
|
||||||
)
|
),
|
||||||
.get();
|
1
|
||||||
assertNoFailures(response);
|
);
|
||||||
assertHitCount(response, 1);
|
|
||||||
|
|
||||||
Exception e = expectThrows(
|
Exception e = expectThrows(
|
||||||
SearchPhaseExecutionException.class,
|
SearchPhaseExecutionException.class,
|
||||||
|
|
|
@ -64,7 +64,7 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertBlocked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.emptyArray;
|
import static org.hamcrest.Matchers.emptyArray;
|
||||||
|
@ -288,7 +288,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
.setQuery(QueryBuilders.matchQuery("name", "bar"))
|
.setQuery(QueryBuilders.matchQuery("name", "bar"))
|
||||||
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
|
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
Global global = searchResponse.getAggregations().get("global");
|
Global global = searchResponse.getAggregations().get("global");
|
||||||
Terms terms = global.getAggregations().get("test");
|
Terms terms = global.getAggregations().get("test");
|
||||||
assertThat(terms.getBuckets().size(), equalTo(4));
|
assertThat(terms.getBuckets().size(), equalTo(4));
|
||||||
|
@ -299,7 +299,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
|
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
|
||||||
.addSort("_index", SortOrder.ASC)
|
.addSort("_index", SortOrder.ASC)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
global = searchResponse.getAggregations().get("global");
|
global = searchResponse.getAggregations().get("global");
|
||||||
terms = global.getAggregations().get("test");
|
terms = global.getAggregations().get("test");
|
||||||
assertThat(terms.getBuckets().size(), equalTo(4));
|
assertThat(terms.getBuckets().size(), equalTo(4));
|
||||||
|
@ -310,7 +310,7 @@ public class IndexAliasesIT extends ESIntegTestCase {
|
||||||
.addAggregation(AggregationBuilders.terms("test").field("name"))
|
.addAggregation(AggregationBuilders.terms("test").field("name"))
|
||||||
.addSort("_index", SortOrder.ASC)
|
.addSort("_index", SortOrder.ASC)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
terms = searchResponse.getAggregations().get("test");
|
terms = searchResponse.getAggregations().get("test");
|
||||||
assertThat(terms.getBuckets().size(), equalTo(2));
|
assertThat(terms.getBuckets().size(), equalTo(2));
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -130,7 +130,7 @@ public class ExceptionRetryIT extends ESIntegTestCase {
|
||||||
dupCounter++;
|
dupCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(dupCounter, equalTo(0L));
|
assertThat(dupCounter, equalTo(0L));
|
||||||
assertHitCount(searchResponse, numDocs);
|
assertHitCount(searchResponse, numDocs);
|
||||||
IndicesStatsResponse index = indicesAdmin().prepareStats("index").clear().setSegments(true).get();
|
IndicesStatsResponse index = indicesAdmin().prepareStats("index").clear().setSegments(true).get();
|
||||||
|
|
|
@ -35,7 +35,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHist
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateRange;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateRange;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
||||||
dateHistogram("histo").field("f").timeZone(ZoneId.of("+01:00")).minDocCount(0).calendarInterval(DateHistogramInterval.MONTH)
|
dateHistogram("histo").field("f").timeZone(ZoneId.of("+01:00")).minDocCount(0).calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r1);
|
assertNoFailures(r1);
|
||||||
|
|
||||||
// The cached is actually used
|
// The cached is actually used
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -86,7 +86,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
||||||
.calendarInterval(DateHistogramInterval.MONTH)
|
.calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r2);
|
assertNoFailures(r2);
|
||||||
Histogram h1 = r1.getAggregations().get("histo");
|
Histogram h1 = r1.getAggregations().get("histo");
|
||||||
Histogram h2 = r2.getAggregations().get("histo");
|
Histogram h2 = r2.getAggregations().get("histo");
|
||||||
final List<? extends Bucket> buckets1 = h1.getBuckets();
|
final List<? extends Bucket> buckets1 = h1.getBuckets();
|
||||||
|
@ -530,7 +530,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
||||||
.setProfile(profile)
|
.setProfile(profile)
|
||||||
.setQuery(QueryBuilders.termQuery("k", "hello"))
|
.setQuery(QueryBuilders.termQuery("k", "hello"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
ElasticsearchAssertions.assertAllSuccessful(resp);
|
ElasticsearchAssertions.assertAllSuccessful(resp);
|
||||||
assertThat(resp.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(resp.getHits().getTotalHits().value, equalTo(1L));
|
||||||
if (profile == false) {
|
if (profile == false) {
|
||||||
|
|
|
@ -9,7 +9,6 @@ package org.elasticsearch.search;
|
||||||
|
|
||||||
import org.apache.lucene.tests.util.English;
|
import org.apache.lucene.tests.util.English;
|
||||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.core.TimeValue;
|
import org.elasticsearch.core.TimeValue;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
@ -19,8 +18,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
import static org.elasticsearch.test.ESIntegTestCase.Scope.SUITE;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
|
||||||
|
|
||||||
@ClusterScope(scope = SUITE)
|
@ClusterScope(scope = SUITE)
|
||||||
public class StressSearchServiceReaperIT extends ESIntegTestCase {
|
public class StressSearchServiceReaperIT extends ESIntegTestCase {
|
||||||
|
@ -45,9 +43,7 @@ public class StressSearchServiceReaperIT extends ESIntegTestCase {
|
||||||
indexRandom(true, builders);
|
indexRandom(true, builders);
|
||||||
final int iterations = scaledRandomIntBetween(500, 1000);
|
final int iterations = scaledRandomIntBetween(500, 1000);
|
||||||
for (int i = 0; i < iterations; i++) {
|
for (int i = 0; i < iterations; i++) {
|
||||||
SearchResponse searchResponse = client().prepareSearch("test").setQuery(matchAllQuery()).setSize(num).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(matchAllQuery()).setSize(num), num);
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, num);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
|
|
||||||
@ESIntegTestCase.SuiteScopeTestCase
|
@ESIntegTestCase.SuiteScopeTestCase
|
||||||
public class AggregationsIntegrationIT extends ESIntegTestCase {
|
public class AggregationsIntegrationIT extends ESIntegTestCase {
|
||||||
|
@ -44,7 +44,7 @@ public class AggregationsIntegrationIT extends ESIntegTestCase {
|
||||||
.setScroll(TimeValue.timeValueMinutes(1))
|
.setScroll(TimeValue.timeValueMinutes(1))
|
||||||
.addAggregation(terms("f").field("f"))
|
.addAggregation(terms("f").field("f"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Aggregations aggregations = response.getAggregations();
|
Aggregations aggregations = response.getAggregations();
|
||||||
assertNotNull(aggregations);
|
assertNotNull(aggregations);
|
||||||
Terms terms = aggregations.get("f");
|
Terms terms = aggregations.get("f");
|
||||||
|
@ -53,7 +53,7 @@ public class AggregationsIntegrationIT extends ESIntegTestCase {
|
||||||
int total = response.getHits().getHits().length;
|
int total = response.getHits().getHits().length;
|
||||||
while (response.getHits().getHits().length > 0) {
|
while (response.getHits().getHits().length > 0) {
|
||||||
response = client().prepareSearchScroll(response.getScrollId()).setScroll(TimeValue.timeValueMinutes(1)).get();
|
response = client().prepareSearchScroll(response.getScrollId()).setScroll(TimeValue.timeValueMinutes(1)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertNull(response.getAggregations());
|
assertNull(response.getAggregations());
|
||||||
total += response.getHits().getHits().length;
|
total += response.getHits().getHits().length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Map;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.missing;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.missing;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
@ -66,7 +66,7 @@ public class CombiIT extends ESIntegTestCase {
|
||||||
.addAggregation(terms("values").field("value").collectMode(aggCollectionMode))
|
.addAggregation(terms("values").field("value").collectMode(aggCollectionMode))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Aggregations aggs = response.getAggregations();
|
Aggregations aggs = response.getAggregations();
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
|
@ -367,7 +366,7 @@ public class EquivalenceIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field("values").interval(interval).minDocCount(1))
|
.addAggregation(histogram("histo").field("values").interval(interval).minDocCount(1))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
|
|
||||||
Terms terms = resp.getAggregations().get("terms");
|
Terms terms = resp.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -427,7 +426,7 @@ public class EquivalenceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("filter");
|
Filter filter = response.getAggregations().get("filter");
|
||||||
assertNotNull(filter);
|
assertNotNull(filter);
|
||||||
|
@ -493,7 +492,7 @@ public class EquivalenceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r1);
|
assertNoFailures(r1);
|
||||||
final SearchResponse r2 = client().prepareSearch("idx")
|
final SearchResponse r2 = client().prepareSearch("idx")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
terms("f1").field("f1")
|
terms("f1").field("f1")
|
||||||
|
@ -505,7 +504,7 @@ public class EquivalenceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r2);
|
assertNoFailures(r2);
|
||||||
|
|
||||||
final Terms t1 = r1.getAggregations().get("f1");
|
final Terms t1 = r1.getAggregations().get("f1");
|
||||||
final Terms t2 = r2.getAggregations().get("f1");
|
final Terms t2 = r2.getAggregations().get("f1");
|
||||||
|
|
|
@ -22,7 +22,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.maxBucket;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.maxBucket;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
|
|
||||||
public class MetadataIT extends ESIntegTestCase {
|
public class MetadataIT extends ESIntegTestCase {
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class MetadataIT extends ESIntegTestCase {
|
||||||
.addAggregation(maxBucket("the_max_bucket", "the_terms>the_sum").setMetadata(metadata))
|
.addAggregation(maxBucket("the_max_bucket", "the_terms>the_sum").setMetadata(metadata))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Aggregations aggs = response.getAggregations();
|
Aggregations aggs = response.getAggregations();
|
||||||
assertNotNull(aggs);
|
assertNotNull(aggs);
|
||||||
|
|
|
@ -30,7 +30,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
|
|
||||||
@ESIntegTestCase.SuiteScopeTestCase
|
@ESIntegTestCase.SuiteScopeTestCase
|
||||||
|
@ -57,7 +57,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(terms("my_terms").field("non_existing_field").missing("bar"))
|
.addAggregation(terms("my_terms").field("non_existing_field").missing("bar"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("my_terms");
|
Terms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(1, terms.getBuckets().size());
|
assertEquals(1, terms.getBuckets().size());
|
||||||
assertEquals(2, terms.getBucketByKey("bar").getDocCount());
|
assertEquals(2, terms.getBucketByKey("bar").getDocCount());
|
||||||
|
@ -68,14 +68,14 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(terms("my_terms").field("str").executionHint(mode.toString()).missing("bar"))
|
.addAggregation(terms("my_terms").field("str").executionHint(mode.toString()).missing("bar"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("my_terms");
|
Terms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
assertEquals(1, terms.getBucketByKey("foo").getDocCount());
|
assertEquals(1, terms.getBucketByKey("foo").getDocCount());
|
||||||
assertEquals(1, terms.getBucketByKey("bar").getDocCount());
|
assertEquals(1, terms.getBucketByKey("bar").getDocCount());
|
||||||
|
|
||||||
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("str").missing("foo")).get();
|
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("str").missing("foo")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("my_terms");
|
terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(1, terms.getBuckets().size());
|
assertEquals(1, terms.getBuckets().size());
|
||||||
assertEquals(2, terms.getBucketByKey("foo").getDocCount());
|
assertEquals(2, terms.getBucketByKey("foo").getDocCount());
|
||||||
|
@ -84,14 +84,14 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testLongTerms() {
|
public void testLongTerms() {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(4)).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(4)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("my_terms");
|
Terms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
assertEquals(1, terms.getBucketByKey("3").getDocCount());
|
assertEquals(1, terms.getBucketByKey("3").getDocCount());
|
||||||
assertEquals(1, terms.getBucketByKey("4").getDocCount());
|
assertEquals(1, terms.getBucketByKey("4").getDocCount());
|
||||||
|
|
||||||
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(3)).get();
|
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("long").missing(3)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("my_terms");
|
terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(1, terms.getBuckets().size());
|
assertEquals(1, terms.getBuckets().size());
|
||||||
assertEquals(2, terms.getBucketByKey("3").getDocCount());
|
assertEquals(2, terms.getBucketByKey("3").getDocCount());
|
||||||
|
@ -99,14 +99,14 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testDoubleTerms() {
|
public void testDoubleTerms() {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("double").missing(4.5)).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("double").missing(4.5)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("my_terms");
|
Terms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
assertEquals(1, terms.getBucketByKey("4.5").getDocCount());
|
assertEquals(1, terms.getBucketByKey("4.5").getDocCount());
|
||||||
assertEquals(1, terms.getBucketByKey("5.5").getDocCount());
|
assertEquals(1, terms.getBucketByKey("5.5").getDocCount());
|
||||||
|
|
||||||
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("double").missing(5.5)).get();
|
response = client().prepareSearch("idx").addAggregation(terms("my_terms").field("double").missing(5.5)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("my_terms");
|
terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(1, terms.getBuckets().size());
|
assertEquals(1, terms.getBuckets().size());
|
||||||
assertEquals(2, terms.getBucketByKey("5.5").getDocCount());
|
assertEquals(2, terms.getBucketByKey("5.5").getDocCount());
|
||||||
|
@ -116,7 +116,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(histogram("my_histogram").field("non-existing_field").interval(5).missing(12))
|
.addAggregation(histogram("my_histogram").field("non-existing_field").interval(5).missing(12))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histogram = response.getAggregations().get("my_histogram");
|
Histogram histogram = response.getAggregations().get("my_histogram");
|
||||||
assertEquals(1, histogram.getBuckets().size());
|
assertEquals(1, histogram.getBuckets().size());
|
||||||
assertEquals(10d, histogram.getBuckets().get(0).getKey());
|
assertEquals(10d, histogram.getBuckets().get(0).getKey());
|
||||||
|
@ -127,7 +127,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(histogram("my_histogram").field("long").interval(5).missing(7))
|
.addAggregation(histogram("my_histogram").field("long").interval(5).missing(7))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histogram = response.getAggregations().get("my_histogram");
|
Histogram histogram = response.getAggregations().get("my_histogram");
|
||||||
assertEquals(2, histogram.getBuckets().size());
|
assertEquals(2, histogram.getBuckets().size());
|
||||||
assertEquals(0d, histogram.getBuckets().get(0).getKey());
|
assertEquals(0d, histogram.getBuckets().get(0).getKey());
|
||||||
|
@ -136,7 +136,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
assertEquals(1, histogram.getBuckets().get(1).getDocCount());
|
assertEquals(1, histogram.getBuckets().get(1).getDocCount());
|
||||||
|
|
||||||
response = client().prepareSearch("idx").addAggregation(histogram("my_histogram").field("long").interval(5).missing(3)).get();
|
response = client().prepareSearch("idx").addAggregation(histogram("my_histogram").field("long").interval(5).missing(3)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
histogram = response.getAggregations().get("my_histogram");
|
histogram = response.getAggregations().get("my_histogram");
|
||||||
assertEquals(1, histogram.getBuckets().size());
|
assertEquals(1, histogram.getBuckets().size());
|
||||||
assertEquals(0d, histogram.getBuckets().get(0).getKey());
|
assertEquals(0d, histogram.getBuckets().get(0).getKey());
|
||||||
|
@ -147,7 +147,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(dateHistogram("my_histogram").field("date").calendarInterval(DateHistogramInterval.YEAR).missing("2014-05-07"))
|
.addAggregation(dateHistogram("my_histogram").field("date").calendarInterval(DateHistogramInterval.YEAR).missing("2014-05-07"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histogram = response.getAggregations().get("my_histogram");
|
Histogram histogram = response.getAggregations().get("my_histogram");
|
||||||
assertEquals(2, histogram.getBuckets().size());
|
assertEquals(2, histogram.getBuckets().size());
|
||||||
assertEquals("2014-01-01T00:00:00.000Z", histogram.getBuckets().get(0).getKeyAsString());
|
assertEquals("2014-01-01T00:00:00.000Z", histogram.getBuckets().get(0).getKeyAsString());
|
||||||
|
@ -158,7 +158,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
response = client().prepareSearch("idx")
|
response = client().prepareSearch("idx")
|
||||||
.addAggregation(dateHistogram("my_histogram").field("date").calendarInterval(DateHistogramInterval.YEAR).missing("2015-05-07"))
|
.addAggregation(dateHistogram("my_histogram").field("date").calendarInterval(DateHistogramInterval.YEAR).missing("2015-05-07"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
histogram = response.getAggregations().get("my_histogram");
|
histogram = response.getAggregations().get("my_histogram");
|
||||||
assertEquals(1, histogram.getBuckets().size());
|
assertEquals(1, histogram.getBuckets().size());
|
||||||
assertEquals("2015-01-01T00:00:00.000Z", histogram.getBuckets().get(0).getKeyAsString());
|
assertEquals("2015-01-01T00:00:00.000Z", histogram.getBuckets().get(0).getKeyAsString());
|
||||||
|
@ -167,7 +167,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testCardinality() {
|
public void testCardinality() {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(cardinality("card").field("long").missing(2)).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(cardinality("card").field("long").missing(2)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Cardinality cardinality = response.getAggregations().get("card");
|
Cardinality cardinality = response.getAggregations().get("card");
|
||||||
assertEquals(2, cardinality.getValue());
|
assertEquals(2, cardinality.getValue());
|
||||||
}
|
}
|
||||||
|
@ -176,14 +176,14 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(percentiles("percentiles").field("long").missing(1000))
|
.addAggregation(percentiles("percentiles").field("long").missing(1000))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Percentiles percentiles = response.getAggregations().get("percentiles");
|
Percentiles percentiles = response.getAggregations().get("percentiles");
|
||||||
assertEquals(1000, percentiles.percentile(100), 0);
|
assertEquals(1000, percentiles.percentile(100), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStats() {
|
public void testStats() {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(stats("stats").field("long").missing(5)).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(stats("stats").field("long").missing(5)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Stats stats = response.getAggregations().get("stats");
|
Stats stats = response.getAggregations().get("stats");
|
||||||
assertEquals(2, stats.getCount());
|
assertEquals(2, stats.getCount());
|
||||||
assertEquals(4, stats.getAvg(), 0);
|
assertEquals(4, stats.getAvg(), 0);
|
||||||
|
@ -193,7 +193,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(geoBounds("bounds").field("non_existing_field").missing("2,1"))
|
.addAggregation(geoBounds("bounds").field("non_existing_field").missing("2,1"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
GeoBounds bounds = response.getAggregations().get("bounds");
|
GeoBounds bounds = response.getAggregations().get("bounds");
|
||||||
assertThat(bounds.bottomRight().lat(), closeTo(2.0, 1E-5));
|
assertThat(bounds.bottomRight().lat(), closeTo(2.0, 1E-5));
|
||||||
assertThat(bounds.bottomRight().lon(), closeTo(1.0, 1E-5));
|
assertThat(bounds.bottomRight().lon(), closeTo(1.0, 1E-5));
|
||||||
|
@ -203,7 +203,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testGeoBounds() {
|
public void testGeoBounds() {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(geoBounds("bounds").field("location").missing("2,1")).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(geoBounds("bounds").field("location").missing("2,1")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
GeoBounds bounds = response.getAggregations().get("bounds");
|
GeoBounds bounds = response.getAggregations().get("bounds");
|
||||||
assertThat(bounds.bottomRight().lat(), closeTo(1.0, 1E-5));
|
assertThat(bounds.bottomRight().lat(), closeTo(1.0, 1E-5));
|
||||||
assertThat(bounds.bottomRight().lon(), closeTo(2.0, 1E-5));
|
assertThat(bounds.bottomRight().lon(), closeTo(2.0, 1E-5));
|
||||||
|
@ -215,7 +215,7 @@ public class MissingValueIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(geoCentroid("centroid").field("location").missing("2,1"))
|
.addAggregation(geoCentroid("centroid").field("location").missing("2,1"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
GeoCentroid centroid = response.getAggregations().get("centroid");
|
GeoCentroid centroid = response.getAggregations().get("centroid");
|
||||||
GeoPoint point = new GeoPoint(1.5, 1.5);
|
GeoPoint point = new GeoPoint(1.5, 1.5);
|
||||||
assertThat(point.getY(), closeTo(centroid.centroid().getY(), 1E-5));
|
assertThat(point.getY(), closeTo(centroid.centroid().getY(), 1E-5));
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde
|
||||||
import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms;
|
import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
|
@ -79,7 +79,7 @@ public class BooleanTermsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -113,7 +113,7 @@ public class BooleanTermsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -149,7 +149,7 @@ public class BooleanTermsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
UnmappedTerms terms = response.getAggregations().get("terms");
|
UnmappedTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
|
|
@ -60,8 +60,8 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -229,7 +229,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -270,7 +270,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
ZoneId tz = ZoneId.of("+01:00");
|
ZoneId tz = ZoneId.of("+01:00");
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -333,7 +333,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.DAY).minDocCount(1).timeZone(tz).format(format)
|
dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.DAY).minDocCount(1).timeZone(tz).format(format)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -366,7 +366,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH).order(BucketOrder.key(true)))
|
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH).order(BucketOrder.key(true)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -388,7 +388,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -409,7 +409,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -430,7 +430,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -451,7 +451,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -513,7 +513,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -537,7 +537,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -561,7 +561,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -585,7 +585,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -641,7 +641,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -686,7 +686,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(dateHistogram("histo").field("dates").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(dateHistogram("histo").field("dates").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -730,7 +730,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -781,7 +781,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -836,7 +836,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -876,7 +876,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -927,7 +927,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -940,7 +940,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(dateHistogram("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -1130,7 +1130,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -1187,7 +1187,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.extendedBounds(new LongBounds("now/d", "now/d+23h"))
|
.extendedBounds(new LongBounds("now/d", "now/d+23h"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
"Expected 24 buckets for one day aggregation with hourly interval",
|
"Expected 24 buckets for one day aggregation with hourly interval",
|
||||||
|
@ -1245,7 +1245,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.extendedBounds(new LongBounds("2016-01-01T06:00:00Z", "2016-01-08T08:00:00Z"))
|
.extendedBounds(new LongBounds("2016-01-01T06:00:00Z", "2016-01-08T08:00:00Z"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -1322,7 +1322,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
ZoneId tz = ZoneId.of("+01:00");
|
ZoneId tz = ZoneId.of("+01:00");
|
||||||
|
|
||||||
|
@ -1370,7 +1370,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.format("yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX")
|
.format("yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo.getBuckets().size(), equalTo(1));
|
assertThat(histo.getBuckets().size(), equalTo(1));
|
||||||
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2014-01-01T00:00:00.000+02:00"));
|
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2014-01-01T00:00:00.000+02:00"));
|
||||||
|
@ -1395,7 +1395,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.minDocCount(0)
|
.minDocCount(0)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo.getBuckets().size(), equalTo(4));
|
assertThat(histo.getBuckets().size(), equalTo(4));
|
||||||
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2014-01-01T00:00:00.000+01:00"));
|
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2014-01-01T00:00:00.000+01:00"));
|
||||||
|
@ -1432,7 +1432,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.extendedBounds(new LongBounds("2018-01", "2018-01"))
|
.extendedBounds(new LongBounds("2018-01", "2018-01"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo.getBuckets().size(), equalTo(1));
|
assertThat(histo.getBuckets().size(), equalTo(1));
|
||||||
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2018-01"));
|
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2018-01"));
|
||||||
|
@ -1455,7 +1455,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
dateHistogram("histo").field("d").calendarInterval(DateHistogramInterval.MONTH).timeZone(ZoneId.of("Europe/Berlin"))
|
dateHistogram("histo").field("d").calendarInterval(DateHistogramInterval.MONTH).timeZone(ZoneId.of("Europe/Berlin"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo.getBuckets().size(), equalTo(1));
|
assertThat(histo.getBuckets().size(), equalTo(1));
|
||||||
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("1477954800000"));
|
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("1477954800000"));
|
||||||
|
@ -1469,7 +1469,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.format("yyyy-MM-dd")
|
.format("yyyy-MM-dd")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
histo = response.getAggregations().get("histo");
|
histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo.getBuckets().size(), equalTo(1));
|
assertThat(histo.getBuckets().size(), equalTo(1));
|
||||||
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2016-11-01"));
|
assertThat(histo.getBuckets().get(0).getKeyAsString(), equalTo("2016-11-01"));
|
||||||
|
@ -1586,7 +1586,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.calendarInterval(DateHistogramInterval.MONTH)
|
.calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1606,7 +1606,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.calendarInterval(DateHistogramInterval.MONTH)
|
.calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1622,7 +1622,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(dateHistogram("histo").field("d").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(dateHistogram("histo").field("d").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1686,7 +1686,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histogram = response.getAggregations().get("histo");
|
Histogram histogram = response.getAggregations().get("histo");
|
||||||
assertThat(histogram, notNullValue());
|
assertThat(histogram, notNullValue());
|
||||||
|
@ -1730,7 +1730,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.addDocValueField("date")
|
.addDocValueField("date")
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
Histogram histogram = r.getAggregations().get("histo");
|
Histogram histogram = r.getAggregations().get("histo");
|
||||||
List<? extends Bucket> buckets = histogram.getBuckets();
|
List<? extends Bucket> buckets = histogram.getBuckets();
|
||||||
|
@ -1746,7 +1746,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.addDocValueField("date")
|
.addDocValueField("date")
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
histogram = r.getAggregations().get("histo");
|
histogram = r.getAggregations().get("histo");
|
||||||
buckets = histogram.getBuckets();
|
buckets = histogram.getBuckets();
|
||||||
|
@ -1764,7 +1764,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
InternalDateHistogram histogram = response.getAggregations().get("histo");
|
InternalDateHistogram histogram = response.getAggregations().get("histo");
|
||||||
List<InternalDateHistogram.Bucket> buckets = histogram.getBuckets();
|
List<InternalDateHistogram.Bucket> buckets = histogram.getBuckets();
|
||||||
|
@ -1782,7 +1782,7 @@ public class DateHistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
InternalDateHistogram histogram = response.getAggregations().get("histo");
|
InternalDateHistogram histogram = response.getAggregations().get("histo");
|
||||||
List<InternalDateHistogram.Bucket> buckets = histogram.getBuckets();
|
List<InternalDateHistogram.Bucket> buckets = histogram.getBuckets();
|
||||||
|
|
|
@ -42,7 +42,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.dateRang
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -136,7 +136,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -171,7 +171,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -217,7 +217,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -264,7 +264,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -318,7 +318,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -364,7 +364,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -420,7 +420,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -495,7 +495,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -541,7 +541,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -661,7 +661,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -684,7 +684,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -706,7 +706,7 @@ public class DateRangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sampler;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sampler;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -101,7 +101,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.subAggregation(sampler("sample").shardSize(100).subAggregation(max("max_price").field("price")))
|
.subAggregation(sampler("sample").shardSize(100).subAggregation(max("max_price").field("price")))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms genres = response.getAggregations().get("genres");
|
Terms genres = response.getAggregations().get("genres");
|
||||||
Collection<? extends Bucket> genreBuckets = genres.getBuckets();
|
Collection<? extends Bucket> genreBuckets = genres.getBuckets();
|
||||||
// For this test to be useful we need >1 genre bucket to compare
|
// For this test to be useful we need >1 genre bucket to compare
|
||||||
|
@ -133,7 +133,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
List<? extends Bucket> testBuckets = authors.getBuckets();
|
List<? extends Bucket> testBuckets = authors.getBuckets();
|
||||||
|
@ -154,7 +154,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
|
|
||||||
rootTerms.subAggregation(sampleAgg);
|
rootTerms.subAggregation(sampleAgg);
|
||||||
SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH).addAggregation(rootTerms).get();
|
SearchResponse response = client().prepareSearch("test").setSearchType(SearchType.QUERY_THEN_FETCH).addAggregation(rootTerms).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms genres = response.getAggregations().get("genres");
|
Terms genres = response.getAggregations().get("genres");
|
||||||
List<? extends Bucket> genreBuckets = genres.getBuckets();
|
List<? extends Bucket> genreBuckets = genres.getBuckets();
|
||||||
for (Terms.Bucket genreBucket : genreBuckets) {
|
for (Terms.Bucket genreBucket : genreBuckets) {
|
||||||
|
@ -186,7 +186,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSearchType(SearchType.QUERY_THEN_FETCH)
|
.setSearchType(SearchType.QUERY_THEN_FETCH)
|
||||||
.addAggregation(rootSample)
|
.addAggregation(rootSample)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler genreSample = response.getAggregations().get("genreSample");
|
Sampler genreSample = response.getAggregations().get("genreSample");
|
||||||
Sampler sample = genreSample.getAggregations().get("sample");
|
Sampler sample = genreSample.getAggregations().get("sample");
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
assertThat(sample.getDocCount(), greaterThan(0L));
|
assertThat(sample.getDocCount(), greaterThan(0L));
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
|
@ -237,7 +237,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
assertThat(sample.getDocCount(), equalTo(0L));
|
assertThat(sample.getDocCount(), equalTo(0L));
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
|
@ -256,7 +256,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
sampleAgg = new DiversifiedAggregationBuilder("sample").shardSize(100);
|
||||||
sampleAgg.field("author").maxDocsPerValue(Integer.MAX_VALUE).executionHint(randomExecutionHint());
|
sampleAgg.field("author").maxDocsPerValue(Integer.MAX_VALUE).executionHint(randomExecutionHint());
|
||||||
|
@ -268,7 +268,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -282,7 +282,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
new TermsAggregationBuilder("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))
|
new TermsAggregationBuilder("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(allResponse);
|
assertNoFailures(allResponse);
|
||||||
DoubleTerms terms = allResponse.getAggregations().get("terms");
|
DoubleTerms terms = allResponse.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -299,7 +299,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("terms");
|
terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -320,7 +320,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -345,7 +345,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -374,7 +374,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -421,7 +421,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -453,7 +453,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -480,7 +480,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -505,7 +505,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -537,7 +537,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -578,7 +578,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms tags = response.getAggregations().get("num_tags");
|
DoubleTerms tags = response.getAggregations().get("num_tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -619,7 +619,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms tags = response.getAggregations().get("tags");
|
DoubleTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -759,7 +759,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -789,7 +789,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -819,7 +819,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -863,7 +863,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -930,7 +930,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -990,7 +990,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1009,7 +1009,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1022,7 +1022,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -81,7 +81,7 @@ public class FilterIT extends ESIntegTestCase {
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", termQuery("tag", "tag1"))).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", termQuery("tag", "tag1"))).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("tag1");
|
Filter filter = response.getAggregations().get("tag1");
|
||||||
assertThat(filter, notNullValue());
|
assertThat(filter, notNullValue());
|
||||||
|
@ -95,7 +95,7 @@ public class FilterIT extends ESIntegTestCase {
|
||||||
QueryBuilder emptyFilter = new BoolQueryBuilder();
|
QueryBuilder emptyFilter = new BoolQueryBuilder();
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", emptyFilter)).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(filter("tag1", emptyFilter)).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("tag1");
|
Filter filter = response.getAggregations().get("tag1");
|
||||||
assertThat(filter, notNullValue());
|
assertThat(filter, notNullValue());
|
||||||
|
@ -107,7 +107,7 @@ public class FilterIT extends ESIntegTestCase {
|
||||||
.addAggregation(filter("tag1", termQuery("tag", "tag1")).subAggregation(avg("avg_value").field("value")))
|
.addAggregation(filter("tag1", termQuery("tag", "tag1")).subAggregation(avg("avg_value").field("value")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("tag1");
|
Filter filter = response.getAggregations().get("tag1");
|
||||||
assertThat(filter, notNullValue());
|
assertThat(filter, notNullValue());
|
||||||
|
@ -132,7 +132,7 @@ public class FilterIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field("value").interval(2L).subAggregation(filter("filter", matchAllQuery())))
|
.addAggregation(histogram("histo").field("value").interval(2L).subAggregation(filter("filter", matchAllQuery())))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
|
|
@ -34,7 +34,7 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.avg;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.filters;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.filters;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -107,7 +107,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -134,7 +134,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -156,7 +156,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -206,7 +206,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field("value").interval(2L).subAggregation(filters("filters", matchAllQuery())))
|
.addAggregation(histogram("histo").field("value").interval(2L).subAggregation(filters("filters", matchAllQuery())))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -273,7 +273,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
.addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")))
|
.addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -303,7 +303,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -334,7 +334,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -360,7 +360,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
.addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")).otherBucket(true))
|
.addAggregation(filters("tags", termQuery("tag", "tag1"), termQuery("tag", "tag2")).otherBucket(true))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
@ -394,7 +394,7 @@ public class FiltersIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filters filters = response.getAggregations().get("tags");
|
Filters filters = response.getAggregations().get("tags");
|
||||||
assertThat(filters, notNullValue());
|
assertThat(filters, notNullValue());
|
||||||
|
|
|
@ -39,7 +39,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.geoDistance;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.geoDistance;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
@ -144,7 +144,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
SearchResponse response = client().prepareSearch("idx").addAggregation(builder).get();
|
SearchResponse response = client().prepareSearch("idx").addAggregation(builder).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
@ -191,7 +191,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
@ -240,7 +240,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
@ -287,7 +287,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
@ -335,7 +335,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
@ -462,7 +462,7 @@ public class GeoDistanceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
Range geoDist = response.getAggregations().get("amsterdam_rings");
|
||||||
assertThat(geoDist, notNullValue());
|
assertThat(geoDist, notNullValue());
|
||||||
|
|
|
@ -36,7 +36,7 @@ import static org.elasticsearch.geometry.utils.Geohash.PRECISION;
|
||||||
import static org.elasticsearch.geometry.utils.Geohash.stringEncode;
|
import static org.elasticsearch.geometry.utils.Geohash.stringEncode;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -136,7 +136,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||||
List<? extends Bucket> buckets = geoGrid.getBuckets();
|
List<? extends Bucket> buckets = geoGrid.getBuckets();
|
||||||
|
@ -163,7 +163,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||||
for (GeoGrid.Bucket cell : geoGrid.getBuckets()) {
|
for (GeoGrid.Bucket cell : geoGrid.getBuckets()) {
|
||||||
|
@ -188,7 +188,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("filtered");
|
Filter filter = response.getAggregations().get("filtered");
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||||
assertThat(geoGrid.getBuckets().size(), equalTo(0));
|
assertThat(geoGrid.getBuckets().size(), equalTo(0));
|
||||||
|
@ -225,7 +225,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
.addAggregation(geohashGrid("geohashgrid").field("location").precision(precision))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||||
for (GeoGrid.Bucket cell : geoGrid.getBuckets()) {
|
for (GeoGrid.Bucket cell : geoGrid.getBuckets()) {
|
||||||
|
@ -245,7 +245,7 @@ public class GeoHashGridIT extends ESIntegTestCase {
|
||||||
.addAggregation(geohashGrid("geohashgrid").field("location").size(1).shardSize(100).precision(precision))
|
.addAggregation(geohashGrid("geohashgrid").field("location").size(1).shardSize(100).precision(precision))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
GeoGrid geoGrid = response.getAggregations().get("geohashgrid");
|
||||||
// Check we only have one bucket with the best match for that resolution
|
// Check we only have one bucket with the best match for that resolution
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -65,7 +65,7 @@ public class GlobalIT extends ESIntegTestCase {
|
||||||
.addAggregation(global("global").subAggregation(stats("value_stats").field("value")))
|
.addAggregation(global("global").subAggregation(stats("value_stats").field("value")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Global global = response.getAggregations().get("global");
|
Global global = response.getAggregations().get("global");
|
||||||
assertThat(global, notNullValue());
|
assertThat(global, notNullValue());
|
||||||
|
|
|
@ -51,7 +51,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -238,7 +238,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -290,7 +290,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch("idx")
|
SearchResponse response = client().prepareSearch("idx")
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).offset(offset))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).offset(offset))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
// shifting by offset>2 creates new extra bucket [0,offset-1]
|
// shifting by offset>2 creates new extra bucket [0,offset-1]
|
||||||
// if offset is >= number of values in original last bucket, that effect is canceled
|
// if offset is >= number of values in original last bucket, that effect is canceled
|
||||||
int expectedNumberOfBuckets = (offset >= (numDocs % interval + 1)) ? numValueBuckets : numValueBuckets + 1;
|
int expectedNumberOfBuckets = (offset >= (numDocs % interval + 1)) ? numValueBuckets : numValueBuckets + 1;
|
||||||
|
@ -324,7 +324,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(true)))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(true)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -345,7 +345,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false)))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -366,7 +366,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(true)))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(true)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -393,7 +393,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(false)))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.count(false)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -424,7 +424,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -467,7 +467,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -509,7 +509,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -551,7 +551,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -595,7 +595,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -633,7 +633,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -689,7 +689,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
final int numBuckets = (numDocs + 1) / interval - 2 / interval + 1;
|
final int numBuckets = (numDocs + 1) / interval - 2 / interval + 1;
|
||||||
final long[] counts = new long[(numDocs + 1) / interval + 1];
|
final long[] counts = new long[(numDocs + 1) / interval + 1];
|
||||||
|
@ -717,7 +717,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval))
|
.addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -738,7 +738,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false)))
|
.addAggregation(histogram("histo").field(MULTI_VALUED_FIELD_NAME).interval(interval).order(BucketOrder.key(false)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -763,7 +763,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
final int numBuckets = (numDocs + 2) / interval - 2 / interval + 1;
|
final int numBuckets = (numDocs + 2) / interval - 2 / interval + 1;
|
||||||
final long[] counts = new long[(numDocs + 2) / interval + 1];
|
final long[] counts = new long[(numDocs + 2) / interval + 1];
|
||||||
|
@ -799,7 +799,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -823,7 +823,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -844,7 +844,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -857,7 +857,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(interval))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -882,7 +882,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -990,7 +990,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -1067,7 +1067,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -1110,7 +1110,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
SearchResponse r = client().prepareSearch("decimal_values")
|
SearchResponse r = client().prepareSearch("decimal_values")
|
||||||
.addAggregation(histogram("histo").field("d").interval(0.7).offset(0.05))
|
.addAggregation(histogram("histo").field("d").interval(0.7).offset(0.05))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
Histogram histogram = r.getAggregations().get("histo");
|
Histogram histogram = r.getAggregations().get("histo");
|
||||||
List<? extends Bucket> buckets = histogram.getBuckets();
|
List<? extends Bucket> buckets = histogram.getBuckets();
|
||||||
|
@ -1157,7 +1157,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.offset(0.05)
|
.offset(0.05)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1178,7 +1178,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.offset(0.05)
|
.offset(0.05)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1194,7 +1194,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(histogram("histo").field("d").interval(0.7).offset(0.05))
|
.addAggregation(histogram("histo").field("d").interval(0.7).offset(0.05))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1280,7 +1280,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
SearchResponse r = client().prepareSearch("test")
|
SearchResponse r = client().prepareSearch("test")
|
||||||
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, null)))
|
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, null)))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
Histogram histogram = r.getAggregations().get("histo");
|
Histogram histogram = r.getAggregations().get("histo");
|
||||||
List<? extends Bucket> buckets = histogram.getBuckets();
|
List<? extends Bucket> buckets = histogram.getBuckets();
|
||||||
|
@ -1291,7 +1291,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
r = client().prepareSearch("test")
|
r = client().prepareSearch("test")
|
||||||
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(null, 0.0)))
|
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(null, 0.0)))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
histogram = r.getAggregations().get("histo");
|
histogram = r.getAggregations().get("histo");
|
||||||
buckets = histogram.getBuckets();
|
buckets = histogram.getBuckets();
|
||||||
|
@ -1301,7 +1301,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
r = client().prepareSearch("test")
|
r = client().prepareSearch("test")
|
||||||
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, 0.3)))
|
.addAggregation(histogram("histo").field("d").interval(0.1).hardBounds(new DoubleBounds(0.0, 0.3)))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
histogram = r.getAggregations().get("histo");
|
histogram = r.getAggregations().get("histo");
|
||||||
buckets = histogram.getBuckets();
|
buckets = histogram.getBuckets();
|
||||||
|
@ -1321,7 +1321,7 @@ public class HistogramIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histogram = response.getAggregations().get("histo");
|
Histogram histogram = response.getAggregations().get("histo");
|
||||||
assertThat(histogram, notNullValue());
|
assertThat(histogram, notNullValue());
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class IpRangeIT extends ESIntegTestCase {
|
||||||
.addUnboundedFrom("192.168.1.10")
|
.addUnboundedFrom("192.168.1.10")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
Range range = rsp.getAggregations().get("my_range");
|
Range range = rsp.getAggregations().get("my_range");
|
||||||
assertEquals(3, range.getBuckets().size());
|
assertEquals(3, range.getBuckets().size());
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ public class IpRangeIT extends ESIntegTestCase {
|
||||||
.addUnboundedFrom("192.168.1.10")
|
.addUnboundedFrom("192.168.1.10")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
Range range = rsp.getAggregations().get("my_range");
|
Range range = rsp.getAggregations().get("my_range");
|
||||||
assertEquals(3, range.getBuckets().size());
|
assertEquals(3, range.getBuckets().size());
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ public class IpRangeIT extends ESIntegTestCase {
|
||||||
.addMaskRange("2001:db8::/64")
|
.addMaskRange("2001:db8::/64")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
Range range = rsp.getAggregations().get("my_range");
|
Range range = rsp.getAggregations().get("my_range");
|
||||||
assertEquals(3, range.getBuckets().size());
|
assertEquals(3, range.getBuckets().size());
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ public class IpRangeIT extends ESIntegTestCase {
|
||||||
.addUnboundedFrom("192.168.1.10")
|
.addUnboundedFrom("192.168.1.10")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
Range range = rsp.getAggregations().get("my_range");
|
Range range = rsp.getAggregations().get("my_range");
|
||||||
assertEquals(3, range.getBuckets().size());
|
assertEquals(3, range.getBuckets().size());
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ public class IpRangeIT extends ESIntegTestCase {
|
||||||
.addUnboundedFrom("192.168.1.10")
|
.addUnboundedFrom("192.168.1.10")
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(rsp);
|
assertNoFailures(rsp);
|
||||||
Range range = rsp.getAggregations().get("my_range");
|
Range range = rsp.getAggregations().get("my_range");
|
||||||
assertEquals(3, range.getBuckets().size());
|
assertEquals(3, range.getBuckets().size());
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
|
|
||||||
public class IpTermsIT extends AbstractTermsTestCase {
|
public class IpTermsIT extends AbstractTermsTestCase {
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class IpTermsIT extends AbstractTermsTestCase {
|
||||||
SearchResponse response = client().prepareSearch("index")
|
SearchResponse response = client().prepareSearch("index")
|
||||||
.addAggregation(new TermsAggregationBuilder("my_terms").script(script).executionHint(randomExecutionHint()))
|
.addAggregation(new TermsAggregationBuilder("my_terms").script(script).executionHint(randomExecutionHint()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms terms = response.getAggregations().get("my_terms");
|
StringTerms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class IpTermsIT extends AbstractTermsTestCase {
|
||||||
SearchResponse response = client().prepareSearch("index")
|
SearchResponse response = client().prepareSearch("index")
|
||||||
.addAggregation(new TermsAggregationBuilder("my_terms").script(script).executionHint(randomExecutionHint()))
|
.addAggregation(new TermsAggregationBuilder("my_terms").script(script).executionHint(randomExecutionHint()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms terms = response.getAggregations().get("my_terms");
|
StringTerms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class IpTermsIT extends AbstractTermsTestCase {
|
||||||
.addAggregation(new TermsAggregationBuilder("my_terms").field("ip").missing("127.0.0.1").executionHint(randomExecutionHint()))
|
.addAggregation(new TermsAggregationBuilder("my_terms").field("ip").missing("127.0.0.1").executionHint(randomExecutionHint()))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms terms = response.getAggregations().get("my_terms");
|
StringTerms terms = response.getAggregations().get("my_terms");
|
||||||
assertEquals(2, terms.getBuckets().size());
|
assertEquals(2, terms.getBuckets().size());
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -268,7 +268,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
SearchResponse allResponse = client().prepareSearch("idx")
|
SearchResponse allResponse = client().prepareSearch("idx")
|
||||||
.addAggregation(new TermsAggregationBuilder("terms").field(field).collectMode(randomFrom(SubAggCollectionMode.values())))
|
.addAggregation(new TermsAggregationBuilder("terms").field(field).collectMode(randomFrom(SubAggCollectionMode.values())))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(allResponse);
|
assertNoFailures(allResponse);
|
||||||
LongTerms terms = allResponse.getAggregations().get("terms");
|
LongTerms terms = allResponse.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -285,7 +285,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("terms");
|
terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -306,7 +306,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
// Scripts force the results to doubles
|
// Scripts force the results to doubles
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
|
@ -332,7 +332,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
// Scripts force the results to doubles
|
// Scripts force the results to doubles
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
|
@ -362,7 +362,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
// The script always converts long to double
|
// The script always converts long to double
|
||||||
DoubleTerms terms = response.getAggregations().get("terms");
|
DoubleTerms terms = response.getAggregations().get("terms");
|
||||||
|
@ -410,7 +410,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -443,7 +443,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -470,7 +470,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -495,7 +495,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -527,7 +527,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -568,7 +568,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms tags = response.getAggregations().get("num_tags");
|
LongTerms tags = response.getAggregations().get("num_tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -609,7 +609,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms tags = response.getAggregations().get("tags");
|
LongTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -749,7 +749,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -780,7 +780,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -811,7 +811,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -882,7 +882,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -942,7 +942,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -961,7 +961,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -974,7 +974,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.extended
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public class NaNSortingIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
final Terms terms = response.getAggregations().get("terms");
|
final Terms terms = response.getAggregations().get("terms");
|
||||||
assertCorrectlySorted(terms, asc, agg);
|
assertCorrectlySorted(terms, asc, agg);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public class NaNSortingIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
final Histogram histo = response.getAggregations().get("histo");
|
final Histogram histo = response.getAggregations().get("histo");
|
||||||
assertCorrectlySorted(histo, asc, agg);
|
assertCorrectlySorted(histo, asc, agg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -182,7 +181,7 @@ public class NestedIT extends ESIntegTestCase {
|
||||||
.addAggregation(nested("nested", "nested").subAggregation(stats("nested_value_stats").field("nested.value")))
|
.addAggregation(nested("nested", "nested").subAggregation(stats("nested_value_stats").field("nested.value")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
double min = Double.POSITIVE_INFINITY;
|
double min = Double.POSITIVE_INFINITY;
|
||||||
double max = Double.NEGATIVE_INFINITY;
|
double max = Double.NEGATIVE_INFINITY;
|
||||||
|
@ -231,7 +230,7 @@ public class NestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
long docCount = 0;
|
long docCount = 0;
|
||||||
long[] counts = new long[numParents + 6];
|
long[] counts = new long[numParents + 6];
|
||||||
|
@ -284,7 +283,7 @@ public class NestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
LongTerms values = response.getAggregations().get("top_values");
|
LongTerms values = response.getAggregations().get("top_values");
|
||||||
assertThat(values, notNullValue());
|
assertThat(values, notNullValue());
|
||||||
|
@ -313,7 +312,7 @@ public class NestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Nested level1 = response.getAggregations().get("level1");
|
Nested level1 = response.getAggregations().get("level1");
|
||||||
assertThat(level1, notNullValue());
|
assertThat(level1, notNullValue());
|
||||||
|
|
|
@ -40,7 +40,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
@ -142,7 +142,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getBuckets().size(), equalTo(numDocs + 1));
|
assertThat(terms.getBuckets().size(), equalTo(numDocs + 1));
|
||||||
|
@ -200,7 +200,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -241,7 +241,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6).format("#"))
|
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6).format("#"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -284,7 +284,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -331,7 +331,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -403,7 +403,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -457,7 +457,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(MULTI_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").field(MULTI_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -517,7 +517,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -581,7 +581,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").script(script).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").script(script).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -622,7 +622,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(MULTI_VALUED_FIELD_NAME).addUnboundedTo(-1).addUnboundedFrom(1000))
|
.addAggregation(range("range").field(MULTI_VALUED_FIELD_NAME).addUnboundedTo(-1).addUnboundedFrom(1000))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -672,7 +672,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").script(script).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").script(script).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -730,7 +730,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -773,7 +773,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
.addAggregation(range("range").field(SINGLE_VALUED_FIELD_NAME).addUnboundedTo(3).addRange(3, 6).addUnboundedFrom(6))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -816,7 +816,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -930,7 +930,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addRange(0, 10)
|
.addRange(0, 10)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -950,7 +950,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addRange(0, 10)
|
.addRange(0, 10)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -963,7 +963,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(range("foo").field("i").addRange(0, 10)).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(range("foo").field("i").addRange(0, 10)).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -980,7 +980,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
.addAggregation(range("range").field("route_length_miles").addUnboundedTo(50.0).addRange(50.0, 150.0).addUnboundedFrom(150.0))
|
.addAggregation(range("range").field("route_length_miles").addUnboundedTo(50.0).addRange(50.0, 150.0).addUnboundedFrom(150.0))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -1011,7 +1011,7 @@ public class RangeIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
|
|
@ -35,7 +35,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -157,7 +156,7 @@ public class ReverseNestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Nested nested = response.getAggregations().get("nested1");
|
Nested nested = response.getAggregations().get("nested1");
|
||||||
assertThat(nested, notNullValue());
|
assertThat(nested, notNullValue());
|
||||||
|
@ -339,7 +338,7 @@ public class ReverseNestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Nested nested = response.getAggregations().get("nested1");
|
Nested nested = response.getAggregations().get("nested1");
|
||||||
assertThat(nested.getName(), equalTo("nested1"));
|
assertThat(nested.getName(), equalTo("nested1"));
|
||||||
assertThat(nested.getDocCount(), equalTo(9L));
|
assertThat(nested.getDocCount(), equalTo(9L));
|
||||||
|
@ -371,7 +370,7 @@ public class ReverseNestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Nested nested = response.getAggregations().get("nested1");
|
Nested nested = response.getAggregations().get("nested1");
|
||||||
assertThat(nested, notNullValue());
|
assertThat(nested, notNullValue());
|
||||||
|
@ -714,7 +713,7 @@ public class ReverseNestedIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Nested nested = response.getAggregations().get("nested1");
|
Nested nested = response.getAggregations().get("nested1");
|
||||||
Terms nestedTerms = nested.getAggregations().get("field2");
|
Terms nestedTerms = nested.getAggregations().get("field2");
|
||||||
|
|
|
@ -26,7 +26,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.max;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sampler;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sampler;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -99,7 +99,7 @@ public class SamplerIT extends ESIntegTestCase {
|
||||||
.subAggregation(sampler("sample").shardSize(100).subAggregation(max("max_price").field("price")))
|
.subAggregation(sampler("sample").shardSize(100).subAggregation(max("max_price").field("price")))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms genres = response.getAggregations().get("genres");
|
Terms genres = response.getAggregations().get("genres");
|
||||||
List<? extends Bucket> genreBuckets = genres.getBuckets();
|
List<? extends Bucket> genreBuckets = genres.getBuckets();
|
||||||
// For this test to be useful we need >1 genre bucket to compare
|
// For this test to be useful we need >1 genre bucket to compare
|
||||||
|
@ -129,7 +129,7 @@ public class SamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
List<? extends Bucket> testBuckets = authors.getBuckets();
|
List<? extends Bucket> testBuckets = authors.getBuckets();
|
||||||
|
@ -151,7 +151,7 @@ public class SamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
assertThat(sample.getDocCount(), equalTo(0L));
|
assertThat(sample.getDocCount(), equalTo(0L));
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
|
@ -169,7 +169,7 @@ public class SamplerIT extends ESIntegTestCase {
|
||||||
.setExplain(true)
|
.setExplain(true)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sampler sample = response.getAggregations().get("sample");
|
Sampler sample = response.getAggregations().get("sample");
|
||||||
assertThat(sample.getDocCount(), greaterThan(0L));
|
assertThat(sample.getDocCount(), greaterThan(0L));
|
||||||
Terms authors = sample.getAggregations().get("authors");
|
Terms authors = sample.getAggregations().get("authors");
|
||||||
|
@ -186,6 +186,6 @@ public class SamplerIT extends ESIntegTestCase {
|
||||||
.setSize(60)
|
.setSize(60)
|
||||||
.addAggregation(sampleAgg)
|
.addAggregation(sampleAgg)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.nested;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Global global = response.getAggregations().get("global");
|
Global global = response.getAggregations().get("global");
|
||||||
Histogram histo = global.getAggregations().get("histo");
|
Histogram histo = global.getAggregations().get("histo");
|
||||||
|
@ -113,7 +113,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Filter filter = response.getAggregations().get("filter");
|
Filter filter = response.getAggregations().get("filter");
|
||||||
Histogram histo = filter.getAggregations().get("histo");
|
Histogram histo = filter.getAggregations().get("histo");
|
||||||
|
@ -129,7 +129,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Missing missing = response.getAggregations().get("missing");
|
Missing missing = response.getAggregations().get("missing");
|
||||||
Histogram histo = missing.getAggregations().get("histo");
|
Histogram histo = missing.getAggregations().get("histo");
|
||||||
|
@ -149,7 +149,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Global global = response.getAggregations().get("global");
|
Global global = response.getAggregations().get("global");
|
||||||
Filter filter = global.getAggregations().get("filter");
|
Filter filter = global.getAggregations().get("filter");
|
||||||
|
@ -168,7 +168,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Nested nested = response.getAggregations().get("nested");
|
Nested nested = response.getAggregations().get("nested");
|
||||||
Histogram histo = nested.getAggregations().get("histo");
|
Histogram histo = nested.getAggregations().get("histo");
|
||||||
|
@ -185,7 +185,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
Histogram histo = terms.getBucketByKey("term").getAggregations().get("histo");
|
Histogram histo = terms.getBucketByKey("term").getAggregations().get("histo");
|
||||||
|
@ -202,7 +202,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
Histogram histo = terms.getBucketByKey("1").getAggregations().get("histo");
|
Histogram histo = terms.getBucketByKey("1").getAggregations().get("histo");
|
||||||
|
@ -219,7 +219,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
Histogram histo = terms.getBucketByKey("1.5").getAggregations().get("histo");
|
Histogram histo = terms.getBucketByKey("1.5").getAggregations().get("histo");
|
||||||
|
@ -236,7 +236,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
||||||
|
@ -253,7 +253,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
||||||
|
@ -270,7 +270,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
Histogram histo = range.getBuckets().get(0).getAggregations().get("histo");
|
||||||
|
@ -287,7 +287,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram topHisto = response.getAggregations().get("topHisto");
|
Histogram topHisto = response.getAggregations().get("topHisto");
|
||||||
Histogram histo = topHisto.getBuckets().get(0).getAggregations().get("histo");
|
Histogram histo = topHisto.getBuckets().get(0).getAggregations().get("histo");
|
||||||
|
@ -304,7 +304,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram topHisto = response.getAggregations().get("topHisto");
|
Histogram topHisto = response.getAggregations().get("topHisto");
|
||||||
Histogram histo = topHisto.getBuckets().iterator().next().getAggregations().get("histo");
|
Histogram histo = topHisto.getBuckets().iterator().next().getAggregations().get("histo");
|
||||||
|
@ -321,7 +321,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid grid = response.getAggregations().get("grid");
|
GeoGrid grid = response.getAggregations().get("grid");
|
||||||
Histogram histo = grid.getBuckets().iterator().next().getAggregations().get("histo");
|
Histogram histo = grid.getBuckets().iterator().next().getAggregations().get("histo");
|
||||||
|
@ -337,7 +337,7 @@ public class ShardReduceIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid grid = response.getAggregations().get("grid");
|
GeoGrid grid = response.getAggregations().get("grid");
|
||||||
Histogram histo = grid.getBuckets().iterator().next().getAggregations().get("histo");
|
Histogram histo = grid.getBuckets().iterator().next().getAggregations().get("histo");
|
||||||
|
|
|
@ -57,7 +57,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.signific
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantText;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantText;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -130,7 +130,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
|
|
||||||
SearchResponse response = request.get();
|
SearchResponse response = request.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms classes = response.getAggregations().get("class");
|
StringTerms classes = response.getAggregations().get("class");
|
||||||
assertThat(classes.getBuckets().size(), equalTo(2));
|
assertThat(classes.getBuckets().size(), equalTo(2));
|
||||||
for (Terms.Bucket classBucket : classes.getBuckets()) {
|
for (Terms.Bucket classBucket : classes.getBuckets()) {
|
||||||
|
@ -287,7 +287,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchResponse response1 = request1.get();
|
SearchResponse response1 = request1.get();
|
||||||
assertSearchResponse(response1);
|
assertNoFailures(response1);
|
||||||
|
|
||||||
SearchRequestBuilder request2;
|
SearchRequestBuilder request2;
|
||||||
if (useSigText) {
|
if (useSigText) {
|
||||||
|
@ -390,9 +390,9 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SearchResponse response = request.get();
|
SearchResponse response = request.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms classes = response.getAggregations().get("class");
|
StringTerms classes = response.getAggregations().get("class");
|
||||||
assertThat(classes.getBuckets().size(), equalTo(2));
|
assertThat(classes.getBuckets().size(), equalTo(2));
|
||||||
Iterator<? extends Terms.Bucket> classBuckets = classes.getBuckets().iterator();
|
Iterator<? extends Terms.Bucket> classBuckets = classes.getBuckets().iterator();
|
||||||
|
@ -428,7 +428,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
.subAggregation(subAgg);
|
.subAggregation(subAgg);
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(query).addAggregation(agg).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(query).addAggregation(agg).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SignificantTerms sigTerms = response.getAggregations().get("significant_terms");
|
SignificantTerms sigTerms = response.getAggregations().get("significant_terms");
|
||||||
assertThat(sigTerms.getBuckets().size(), equalTo(2));
|
assertThat(sigTerms.getBuckets().size(), equalTo(2));
|
||||||
|
@ -504,7 +504,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SearchResponse response = request.get();
|
SearchResponse response = request.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
for (Terms.Bucket classBucket : ((Terms) response.getAggregations().get("class")).getBuckets()) {
|
for (Terms.Bucket classBucket : ((Terms) response.getAggregations().get("class")).getBuckets()) {
|
||||||
SignificantTerms sigTerms = classBucket.getAggregations().get("mySignificantTerms");
|
SignificantTerms sigTerms = classBucket.getAggregations().get("mySignificantTerms");
|
||||||
for (SignificantTerms.Bucket bucket : sigTerms.getBuckets()) {
|
for (SignificantTerms.Bucket bucket : sigTerms.getBuckets()) {
|
||||||
|
@ -598,7 +598,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
.addAggregation(significantTerms("foo").field("s").significanceHeuristic(scriptHeuristic))
|
.addAggregation(significantTerms("foo").field("s").significanceHeuristic(scriptHeuristic))
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -623,7 +623,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
.addAggregation(significantTerms("foo").field("s").significanceHeuristic(scriptHeuristic))
|
.addAggregation(significantTerms("foo").field("s").significanceHeuristic(scriptHeuristic))
|
||||||
.get();
|
.get();
|
||||||
}
|
}
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -640,7 +640,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
|
||||||
} else {
|
} else {
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(significantTerms("foo").field("s")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(significantTerms("foo").field("s")).get();
|
||||||
}
|
}
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.anyOf;
|
import static org.hamcrest.Matchers.anyOf;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -278,7 +278,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx")
|
SearchResponse testResponse = client().prepareSearch("idx")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -291,7 +291,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -323,7 +323,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountErrorSingleResponse(size, testResponse);
|
assertNoDocCountErrorSingleResponse(size, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -378,7 +378,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -412,7 +412,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -446,7 +446,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -482,7 +482,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -503,7 +503,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -518,7 +518,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx")
|
SearchResponse testResponse = client().prepareSearch("idx")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -550,7 +550,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -582,7 +582,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountErrorSingleResponse(size, testResponse);
|
assertNoDocCountErrorSingleResponse(size, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -637,7 +637,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -657,7 +657,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -671,7 +671,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -691,7 +691,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -705,7 +705,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -741,7 +741,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -762,7 +762,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -777,7 +777,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx")
|
SearchResponse testResponse = client().prepareSearch("idx")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -809,7 +809,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
assertDocCountErrorWithinBounds(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -828,7 +828,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -841,7 +841,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -862,7 +862,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountErrorSingleResponse(size, testResponse);
|
assertNoDocCountErrorSingleResponse(size, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -882,7 +882,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -896,7 +896,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -930,7 +930,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -950,7 +950,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -964,7 +964,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertNoDocCountError(size, accurateResponse, testResponse);
|
assertNoDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -985,7 +985,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -1000,7 +1000,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -1021,7 +1021,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(accurateResponse);
|
assertNoFailures(accurateResponse);
|
||||||
|
|
||||||
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
SearchResponse testResponse = client().prepareSearch("idx_single_shard")
|
||||||
.addAggregation(
|
.addAggregation(
|
||||||
|
@ -1036,7 +1036,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(testResponse);
|
assertNoFailures(testResponse);
|
||||||
|
|
||||||
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
assertUnboundedDocCountError(size, accurateResponse, testResponse);
|
||||||
}
|
}
|
||||||
|
@ -1057,7 +1057,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1112,7 +1112,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms.getDocCountError(), equalTo(0L));
|
assertThat(terms.getDocCountError(), equalTo(0L));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantTerms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.significantTerms;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
||||||
|
@ -72,7 +72,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
InternalFilter filteredBucket = response.getAggregations().get("inclass");
|
InternalFilter filteredBucket = response.getAggregations().get("inclass");
|
||||||
SignificantTerms sigterms = filteredBucket.getAggregations().get("mySignificantTerms");
|
SignificantTerms sigterms = filteredBucket.getAggregations().get("mySignificantTerms");
|
||||||
assertThat(sigterms.getBuckets().size(), equalTo(0));
|
assertThat(sigterms.getBuckets().size(), equalTo(0));
|
||||||
|
@ -89,7 +89,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
filteredBucket = response.getAggregations().get("inclass");
|
filteredBucket = response.getAggregations().get("inclass");
|
||||||
sigterms = filteredBucket.getAggregations().get("mySignificantTerms");
|
sigterms = filteredBucket.getAggregations().get("mySignificantTerms");
|
||||||
assertThat(sigterms.getBuckets().size(), equalTo(2));
|
assertThat(sigterms.getBuckets().size(), equalTo(2));
|
||||||
|
@ -136,7 +136,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
||||||
.order(BucketOrder.key(true))
|
.order(BucketOrder.key(true))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms sigterms = response.getAggregations().get("myTerms");
|
Terms sigterms = response.getAggregations().get("myTerms");
|
||||||
assertThat(sigterms.getBuckets().size(), equalTo(0));
|
assertThat(sigterms.getBuckets().size(), equalTo(0));
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ public class TermsShardMinDocCountIT extends ESIntegTestCase {
|
||||||
.order(BucketOrder.key(true))
|
.order(BucketOrder.key(true))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
sigterms = response.getAggregations().get("myTerms");
|
sigterms = response.getAggregations().get("myTerms");
|
||||||
assertThat(sigterms.getBuckets().size(), equalTo(2));
|
assertThat(sigterms.getBuckets().size(), equalTo(2));
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.filter;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -305,7 +305,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
new TermsAggregationBuilder("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))
|
new TermsAggregationBuilder("terms").field(field).size(10000).collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(allResponse);
|
assertNoFailures(allResponse);
|
||||||
StringTerms terms = allResponse.getAggregations().get("terms");
|
StringTerms terms = allResponse.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -322,7 +322,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
terms = response.getAggregations().get("terms");
|
terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -343,7 +343,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -368,7 +368,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -397,7 +397,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -426,7 +426,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -473,7 +473,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -504,7 +504,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -536,7 +536,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -564,7 +564,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -655,7 +655,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms tags = response.getAggregations().get("tags");
|
StringTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -697,7 +697,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms tags = response.getAggregations().get("tags");
|
StringTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -760,7 +760,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms tags = response.getAggregations().get("tags");
|
StringTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -823,7 +823,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms tags = response.getAggregations().get("tags");
|
StringTerms tags = response.getAggregations().get("tags");
|
||||||
assertThat(tags, notNullValue());
|
assertThat(tags, notNullValue());
|
||||||
|
@ -972,7 +972,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1004,7 +1004,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1037,7 +1037,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1073,7 +1073,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1157,7 +1157,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1188,7 +1188,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms terms = response.getAggregations().get("terms");
|
StringTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
@ -1241,7 +1241,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1260,7 +1260,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "'foo_' + _value", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "'foo_' + _value", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1273,7 +1273,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(new TermsAggregationBuilder("terms").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1297,7 +1297,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
|
||||||
try (XContentParser parser = createParser(JsonXContent.jsonXContent, source)) {
|
try (XContentParser parser = createParser(JsonXContent.jsonXContent, source)) {
|
||||||
SearchResponse response = client().prepareSearch("idx").setSource(new SearchSourceBuilder().parseXContent(parser, true)).get();
|
SearchResponse response = client().prepareSearch("idx").setSource(new SearchSourceBuilder().parseXContent(parser, true)).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
LongTerms terms = response.getAggregations().get("terms");
|
LongTerms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
assertThat(terms.getName(), equalTo("terms"));
|
assertThat(terms.getName(), equalTo("terms"));
|
||||||
|
|
|
@ -38,7 +38,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.missing;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -873,7 +873,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -892,7 +892,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -905,7 +905,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(extendedStats("foo").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(extendedStats("foo").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.elasticsearch.common.geo.SpatialPoint;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.geo.RandomGeoGenerator;
|
import org.elasticsearch.test.geo.RandomGeoGenerator;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -30,7 +30,7 @@ public class GeoBoundsIT extends SpatialBoundsAggregationTestBase<GeoPoint> {
|
||||||
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME).wrapLongitude(false))
|
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME).wrapLongitude(false))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoPoint geoValuesTopLeft = new GeoPoint(38, -179);
|
GeoPoint geoValuesTopLeft = new GeoPoint(38, -179);
|
||||||
GeoPoint geoValuesBottomRight = new GeoPoint(-24, 178);
|
GeoPoint geoValuesBottomRight = new GeoPoint(-24, 178);
|
||||||
|
@ -54,7 +54,7 @@ public class GeoBoundsIT extends SpatialBoundsAggregationTestBase<GeoPoint> {
|
||||||
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME).wrapLongitude(true))
|
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME).wrapLongitude(true))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoBounds geoBounds = response.getAggregations().get(aggName());
|
GeoBounds geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.test.geo.RandomGeoGenerator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.geohashGrid;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class GeoCentroidIT extends CentroidAggregationTestBase {
|
||||||
.subAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
.subAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
GeoGrid grid = response.getAggregations().get("geoGrid");
|
GeoGrid grid = response.getAggregations().get("geoGrid");
|
||||||
assertThat(grid, notNullValue());
|
assertThat(grid, notNullValue());
|
||||||
|
|
|
@ -39,7 +39,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||||
|
@ -584,7 +584,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -604,7 +604,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -620,7 +620,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(percentileRanks("foo", new double[] { 50.0 }).method(PercentilesMethod.HDR).field("d"))
|
.addAggregation(percentileRanks("foo", new double[] { 50.0 }).method(PercentilesMethod.HDR).field("d"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -554,7 +554,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -575,7 +575,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -591,7 +591,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(percentiles("foo").method(PercentilesMethod.HDR).field("d").percentiles(50.0))
|
.addAggregation(percentiles("foo").method(PercentilesMethod.HDR).field("d").percentiles(50.0))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -45,7 +45,7 @@ import static org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviat
|
||||||
import static org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.IsCloseToRelative.closeToRelative;
|
import static org.elasticsearch.search.aggregations.metrics.MedianAbsoluteDeviationAggregatorTests.IsCloseToRelative.closeToRelative;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
|
@ -517,7 +517,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -536,7 +536,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -549,7 +549,7 @@ public class MedianAbsoluteDeviationIT extends AbstractNumericTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(randomBuilder().field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(randomBuilder().field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -49,7 +49,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.scriptedMetric;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.scriptedMetric;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
@ -363,7 +363,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.setQuery(matchAllQuery())
|
.setQuery(matchAllQuery())
|
||||||
.addAggregation(scriptedMetric("scripted").mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript))
|
.addAggregation(scriptedMetric("scripted").mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -411,7 +411,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(reduceScript)
|
.reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -463,7 +463,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "no-op list aggregation", Collections.emptyMap()))
|
.reduceScript(new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "no-op list aggregation", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -517,7 +517,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -580,7 +580,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(reduceScript)
|
.reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -648,7 +648,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(reduceScript)
|
.reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -707,7 +707,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Global global = searchResponse.getAggregations().get("global");
|
Global global = searchResponse.getAggregations().get("global");
|
||||||
|
@ -765,7 +765,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -815,7 +815,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(reduceScript)
|
.reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -859,7 +859,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
scriptedMetric("scripted").params(params).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -917,7 +917,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(reduceScript)
|
.reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -952,7 +952,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.reduceScript(new Script(ScriptType.STORED, null, "reduceScript_stored", Collections.emptyMap()))
|
.reduceScript(new Script(ScriptType.STORED, null, "reduceScript_stored", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
|
|
||||||
Aggregation aggregation = response.getAggregations().get("scripted");
|
Aggregation aggregation = response.getAggregations().get("scripted");
|
||||||
|
@ -1012,7 +1012,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
assertThat(response.getHits().getTotalHits().value, equalTo(numDocs));
|
||||||
Aggregation aggregation = response.getAggregations().get("histo");
|
Aggregation aggregation = response.getAggregations().get("histo");
|
||||||
assertThat(aggregation, notNullValue());
|
assertThat(aggregation, notNullValue());
|
||||||
|
@ -1150,7 +1150,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
scriptedMetric("foo").initScript(ndInitScript).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
scriptedMetric("foo").initScript(ndInitScript).mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1166,7 +1166,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(scriptedMetric("foo").mapScript(ndMapScript).combineScript(combineScript).reduceScript(reduceScript))
|
.addAggregation(scriptedMetric("foo").mapScript(ndMapScript).combineScript(combineScript).reduceScript(reduceScript))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1182,7 +1182,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(ndRandom).reduceScript(reduceScript))
|
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(ndRandom).reduceScript(reduceScript))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1198,7 +1198,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(combineScript).reduceScript(ndRandom))
|
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(combineScript).reduceScript(ndRandom))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1214,7 +1214,7 @@ public class ScriptedMetricIT extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript))
|
.addAggregation(scriptedMetric("foo").mapScript(mapScript).combineScript(combineScript).reduceScript(reduceScript))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -34,7 +34,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.stats;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -261,7 +261,7 @@ public class StatsIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -280,7 +280,7 @@ public class StatsIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value + 1", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -293,7 +293,7 @@ public class StatsIT extends AbstractNumericTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(stats("foo").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(stats("foo").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -38,7 +38,7 @@ import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugi
|
||||||
import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugin.VALUE_SCRIPT;
|
import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugin.VALUE_SCRIPT;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ public class SumIT extends AbstractNumericTestCase {
|
||||||
sum("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, RANDOM_SCRIPT, Collections.emptyMap()))
|
sum("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, RANDOM_SCRIPT, Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -256,7 +256,7 @@ public class SumIT extends AbstractNumericTestCase {
|
||||||
sum("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))
|
sum("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_SCRIPT, Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -269,7 +269,7 @@ public class SumIT extends AbstractNumericTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(sum("foo").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(sum("foo").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -286,7 +286,7 @@ public class SumIT extends AbstractNumericTestCase {
|
||||||
.addAggregation(sum("sum").field("route_length_miles"))
|
.addAggregation(sum("sum").field("route_length_miles"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Sum sum = response.getAggregations().get("sum");
|
Sum sum = response.getAggregations().get("sum");
|
||||||
assertThat(sum, IsNull.notNullValue());
|
assertThat(sum, IsNull.notNullValue());
|
||||||
|
@ -299,7 +299,7 @@ public class SumIT extends AbstractNumericTestCase {
|
||||||
.addAggregation(terms("terms").field("transit_mode").subAggregation(sum("sum").field("route_length_miles")))
|
.addAggregation(terms("terms").field("transit_mode").subAggregation(sum("sum").field("route_length_miles")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
|
|
@ -39,7 +39,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||||
|
@ -495,7 +495,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -514,7 +514,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -530,7 +530,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(percentileRanks("foo", new double[] { 50.0 }).field("d"))
|
.addAggregation(percentileRanks("foo", new double[] { 50.0 }).field("d"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||||
|
@ -468,7 +468,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "Math.random()", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -488,7 +488,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
.script(new Script(ScriptType.INLINE, AggregationTestScriptsPlugin.NAME, "_value - 1", emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -501,7 +501,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(percentiles("foo").field("d").percentiles(50.0)).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(percentiles("foo").field("d").percentiles(50.0)).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -65,7 +65,6 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.topHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.smileBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.smileBuilder;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.yamlBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.yamlBuilder;
|
||||||
|
@ -320,7 +319,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -354,7 +353,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.addAggregation(terms("terms").executionHint(randomExecutionHint()).field("group").subAggregation(topHits("hits")))
|
.addAggregation(terms("terms").executionHint(randomExecutionHint()).field("group").subAggregation(topHits("hits")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(8L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(8L));
|
||||||
assertThat(response.getHits().getHits().length, equalTo(0));
|
assertThat(response.getHits().getHits().length, equalTo(0));
|
||||||
|
@ -388,7 +387,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.addAggregation(terms("terms").executionHint(randomExecutionHint()).field("group"))
|
.addAggregation(terms("terms").executionHint(randomExecutionHint()).field("group"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(8L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(8L));
|
||||||
assertThat(response.getHits().getHits().length, equalTo(0));
|
assertThat(response.getHits().getHits().length, equalTo(0));
|
||||||
|
@ -409,7 +408,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -442,7 +441,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -469,7 +468,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.addAggregation(global("global").subAggregation(topHits("hits")))
|
.addAggregation(global("global").subAggregation(topHits("hits")))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Global global = searchResponse.getAggregations().get("global");
|
Global global = searchResponse.getAggregations().get("global");
|
||||||
assertThat(global, notNullValue());
|
assertThat(global, notNullValue());
|
||||||
|
@ -494,7 +493,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.subAggregation(topHits("hits").sort(SortBuilders.fieldSort(SORT_FIELD).order(SortOrder.DESC)).from(from).size(size))
|
.subAggregation(topHits("hits").sort(SortBuilders.fieldSort(SORT_FIELD).order(SortOrder.DESC)).from(from).size(size))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SearchResponse control = client().prepareSearch("idx")
|
SearchResponse control = client().prepareSearch("idx")
|
||||||
.setFrom(from)
|
.setFrom(from)
|
||||||
|
@ -502,7 +501,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.setPostFilter(QueryBuilders.termQuery(TERMS_AGGS_FIELD, "val0"))
|
.setPostFilter(QueryBuilders.termQuery(TERMS_AGGS_FIELD, "val0"))
|
||||||
.addSort(SORT_FIELD, SortOrder.DESC)
|
.addSort(SORT_FIELD, SortOrder.DESC)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(control);
|
assertNoFailures(control);
|
||||||
SearchHits controlHits = control.getHits();
|
SearchHits controlHits = control.getHits();
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
|
@ -541,7 +540,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.subAggregation(max("max_sort").field(SORT_FIELD))
|
.subAggregation(max("max_sort").field(SORT_FIELD))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -578,7 +577,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.subAggregation(max("max_score").field("value"))
|
.subAggregation(max("max_score").field("value"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -632,7 +631,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -699,7 +698,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
public void testEmptyIndex() throws Exception {
|
public void testEmptyIndex() throws Exception {
|
||||||
SearchResponse response = client().prepareSearch("empty").addAggregation(topHits("hits")).get();
|
SearchResponse response = client().prepareSearch("empty").addAggregation(topHits("hits")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
TopHits hits = response.getAggregations().get("hits");
|
TopHits hits = response.getAggregations().get("hits");
|
||||||
assertThat(hits, notNullValue());
|
assertThat(hits, notNullValue());
|
||||||
|
@ -718,7 +717,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
.subAggregation(topHits("hits").trackScores(trackScore).size(1).sort("_index", SortOrder.DESC))
|
.subAggregation(topHits("hits").trackScores(trackScore).size(1).sort("_index", SortOrder.DESC))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1077,7 +1076,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -1139,7 +1138,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1162,7 +1161,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1180,7 +1179,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
topHits("foo").scriptField("bar", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "5", Collections.emptyMap()))
|
topHits("foo").scriptField("bar", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "5", Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1203,7 +1202,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -1216,7 +1215,7 @@ public class TopHitsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(topHits("foo")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(topHits("foo")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -37,7 +37,7 @@ import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugi
|
||||||
import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugin.VALUE_FIELD_SCRIPT;
|
import static org.elasticsearch.search.aggregations.metrics.MetricAggScriptPlugin.VALUE_FIELD_SCRIPT;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -241,7 +241,7 @@ public class ValueCountIT extends ESIntegTestCase {
|
||||||
count("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, RANDOM_SCRIPT, Collections.emptyMap()))
|
count("foo").field("d").script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, RANDOM_SCRIPT, Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -260,7 +260,7 @@ public class ValueCountIT extends ESIntegTestCase {
|
||||||
.script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, Collections.emptyMap()))
|
.script(new Script(ScriptType.INLINE, METRIC_SCRIPT_ENGINE, VALUE_FIELD_SCRIPT, Collections.emptyMap()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
@ -273,7 +273,7 @@ public class ValueCountIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// Ensure that non-scripted requests are cached as normal
|
// Ensure that non-scripted requests are cached as normal
|
||||||
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(count("foo").field("d")).get();
|
r = client().prepareSearch("cache_test_idx").setSize(0).addAggregation(count("foo").field("d")).get();
|
||||||
assertSearchResponse(r);
|
assertNoFailures(r);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
indicesAdmin().prepareStats("cache_test_idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(),
|
||||||
|
|
|
@ -37,7 +37,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.histogra
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -134,7 +134,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", histoName + ">_count"))
|
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", histoName + ">_count"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get(histoName);
|
Histogram histo = response.getAggregations().get(histoName);
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -170,7 +170,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -208,7 +208,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", termsName + ">sum"))
|
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", termsName + ">sum"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -250,7 +250,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -308,7 +308,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -355,7 +355,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", termsName + ">sum"))
|
.addAggregation(BucketMetricsPipelineAgg("pipeline_agg", termsName + ">sum"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -385,7 +385,7 @@ abstract class BucketMetricsPipeLineAggregationTestCase<T extends NumericMetrics
|
||||||
.addAggregation(BucketMetricsPipelineAgg("nested_terms_bucket", termsName + ">nested_histo_bucket." + nestedMetric()))
|
.addAggregation(BucketMetricsPipelineAgg("nested_terms_bucket", termsName + ">nested_histo_bucket." + nestedMetric()))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
|
|
@ -42,7 +42,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.percenti
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.bucketScript;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.bucketScript;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -174,7 +174,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -224,7 +224,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -274,7 +274,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Range range = response.getAggregations().get("range");
|
Range range = response.getAggregations().get("range");
|
||||||
assertThat(range, notNullValue());
|
assertThat(range, notNullValue());
|
||||||
|
@ -320,7 +320,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -366,7 +366,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -413,7 +413,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -463,7 +463,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -509,7 +509,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -552,7 +552,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -602,7 +602,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram deriv = response.getAggregations().get("histo");
|
Histogram deriv = response.getAggregations().get("histo");
|
||||||
assertThat(deriv, notNullValue());
|
assertThat(deriv, notNullValue());
|
||||||
|
@ -630,7 +630,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -683,7 +683,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -732,7 +732,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -791,7 +791,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -885,7 +885,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
@ -940,7 +940,7 @@ public class BucketScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
|
|
|
@ -26,7 +26,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.histogra
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.extendedStatsBucket;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.extendedStatsBucket;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
|
@ -104,7 +104,7 @@ public class ExtendedStatsBucketIT extends BucketMetricsPipeLineAggregationTestC
|
||||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1L))
|
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1L))
|
||||||
.addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count").sigma(sigma))
|
.addAggregation(extendedStatsBucket("extended_stats_bucket", "histo>_count").sigma(sigma))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("histo");
|
Histogram histo = response.getAggregations().get("histo");
|
||||||
assertThat(histo, notNullValue());
|
assertThat(histo, notNullValue());
|
||||||
assertThat(histo.getName(), equalTo("histo"));
|
assertThat(histo.getName(), equalTo("histo"));
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.histogra
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.percentilesBucket;
|
import static org.elasticsearch.search.aggregations.PipelineAggregatorBuilders.percentilesBucket;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.core.IsNull.notNullValue;
|
import static org.hamcrest.core.IsNull.notNullValue;
|
||||||
|
@ -73,7 +73,7 @@ public class PercentilesBucketIT extends BucketMetricsPipeLineAggregationTestCas
|
||||||
.addAggregation(percentilesBucket("percentiles_bucket", termsName + ">sum"))
|
.addAggregation(percentilesBucket("percentiles_bucket", termsName + ">sum"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -110,7 +110,7 @@ public class PercentilesBucketIT extends BucketMetricsPipeLineAggregationTestCas
|
||||||
.addAggregation(percentilesBucket("percentiles_bucket", termsName + ">sum").setPercents(PERCENTS))
|
.addAggregation(percentilesBucket("percentiles_bucket", termsName + ">sum").setPercents(PERCENTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -208,7 +208,7 @@ public class PercentilesBucketIT extends BucketMetricsPipeLineAggregationTestCas
|
||||||
.addAggregation(percentilesBucket("percentile_terms_bucket", termsName + ">percentile_histo_bucket[99.9]").setPercents(percent))
|
.addAggregation(percentilesBucket("percentile_terms_bucket", termsName + ">percentile_histo_bucket[99.9]").setPercents(percent))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get(termsName);
|
Terms terms = response.getAggregations().get(termsName);
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
|
|
@ -32,8 +32,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
|
||||||
|
|
||||||
public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase {
|
public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
|
@ -193,9 +192,7 @@ public class SearchWithRandomIOExceptionsIT extends ESIntegTestCase {
|
||||||
indicesAdmin().prepareClose("test").execute().get();
|
indicesAdmin().prepareClose("test").execute().get();
|
||||||
indicesAdmin().prepareOpen("test").execute().get();
|
indicesAdmin().prepareOpen("test").execute().get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
SearchResponse searchResponse = client().prepareSearch().setQuery(QueryBuilders.matchQuery("test", "init")).get();
|
assertHitCountAndNoFailures(client().prepareSearch().setQuery(QueryBuilders.matchQuery("test", "init")), numInitialDocs);
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, numInitialDocs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public class FetchSubPhasePluginIT extends ESIntegTestCase {
|
||||||
SearchResponse response = client().prepareSearch()
|
SearchResponse response = client().prepareSearch()
|
||||||
.setSource(new SearchSourceBuilder().ext(Collections.singletonList(new TermVectorsFetchBuilder("test"))))
|
.setSource(new SearchSourceBuilder().ext(Collections.singletonList(new TermVectorsFetchBuilder("test"))))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(
|
assertThat(
|
||||||
((Map<String, Integer>) response.getHits().getAt(0).field("term_vectors_fetch").getValues().get(0)).get("i"),
|
((Map<String, Integer>) response.getHits().getAt(0).field("term_vectors_fetch").getValues().get(0)).get("i"),
|
||||||
equalTo(2)
|
equalTo(2)
|
||||||
|
|
|
@ -50,6 +50,7 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
||||||
|
@ -952,9 +953,7 @@ public class InnerHitsIT extends ESIntegTestCase {
|
||||||
QueryBuilder query = nestedQuery("nested", matchQuery("nested.field", "value1"), ScoreMode.Avg).innerHit(
|
QueryBuilder query = nestedQuery("nested", matchQuery("nested.field", "value1"), ScoreMode.Avg).innerHit(
|
||||||
new InnerHitBuilder().setSize(ArrayUtil.MAX_ARRAY_LENGTH - 1)
|
new InnerHitBuilder().setSize(ArrayUtil.MAX_ARRAY_LENGTH - 1)
|
||||||
);
|
);
|
||||||
SearchResponse response = client().prepareSearch("index2").setQuery(query).get();
|
assertHitCountAndNoFailures(client().prepareSearch("index2").setQuery(query), 1);
|
||||||
assertNoFailures(response);
|
|
||||||
assertHitCount(response, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTooHighResultWindow() throws Exception {
|
public void testTooHighResultWindow() throws Exception {
|
||||||
|
@ -966,15 +965,15 @@ public class InnerHitsIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.setRefreshPolicy(IMMEDIATE)
|
.setRefreshPolicy(IMMEDIATE)
|
||||||
.get();
|
.get();
|
||||||
SearchResponse response = client().prepareSearch("index2")
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(
|
client().prepareSearch("index2")
|
||||||
nestedQuery("nested", matchQuery("nested.field", "value1"), ScoreMode.Avg).innerHit(
|
.setQuery(
|
||||||
new InnerHitBuilder().setFrom(50).setSize(10).setName("_name")
|
nestedQuery("nested", matchQuery("nested.field", "value1"), ScoreMode.Avg).innerHit(
|
||||||
)
|
new InnerHitBuilder().setFrom(50).setSize(10).setName("_name")
|
||||||
)
|
)
|
||||||
.get();
|
),
|
||||||
assertNoFailures(response);
|
1
|
||||||
assertHitCount(response, 1);
|
);
|
||||||
|
|
||||||
Exception e = expectThrows(
|
Exception e = expectThrows(
|
||||||
SearchPhaseExecutionException.class,
|
SearchPhaseExecutionException.class,
|
||||||
|
|
|
@ -93,7 +93,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHigh
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNotHighlighted;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNotHighlighted;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.anyOf;
|
import static org.hamcrest.Matchers.anyOf;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
@ -3349,7 +3348,7 @@ public class HighlighterSearchIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(r1);
|
assertNoFailures(r1);
|
||||||
assertThat(r1.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(r1.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertHighlight(r1, 0, "field", 0, 1, equalTo("<x>hello</x> world"));
|
assertHighlight(r1, 0, "field", 0, 1, equalTo("<x>hello</x> world"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasSize;
|
import static org.hamcrest.Matchers.hasSize;
|
||||||
|
@ -1033,7 +1032,7 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SearchResponse resp = req.get();
|
SearchResponse resp = req.get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
for (SearchHit hit : resp.getHits().getHits()) {
|
for (SearchHit hit : resp.getHits().getHits()) {
|
||||||
final int id = Integer.parseInt(hit.getId());
|
final int id = Integer.parseInt(hit.getId());
|
||||||
Map<String, DocumentField> fields = hit.getFields();
|
Map<String, DocumentField> fields = hit.getFields();
|
||||||
|
@ -1271,7 +1270,7 @@ public class SearchFieldsIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").addStoredField("field1").get();
|
SearchResponse response = client().prepareSearch("test").addStoredField("field1").get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
|
|
||||||
Map<String, DocumentField> fields = response.getHits().getAt(0).getMetadataFields();
|
Map<String, DocumentField> fields = response.getHits().getAt(0).getMetadataFields();
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.search.lookup.SearchLookup;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||||
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -47,6 +46,7 @@ import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction;
|
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.scriptFunction;
|
||||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -137,7 +137,7 @@ public class ExplainableScriptIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
).actionGet();
|
).actionGet();
|
||||||
|
|
||||||
ElasticsearchAssertions.assertNoFailures(response);
|
assertNoFailures(response);
|
||||||
SearchHits hits = response.getHits();
|
SearchHits hits = response.getHits();
|
||||||
assertThat(hits.getTotalHits().value, equalTo(20L));
|
assertThat(hits.getTotalHits().value, equalTo(20L));
|
||||||
int idCounter = 19;
|
int idCounter = 19;
|
||||||
|
|
|
@ -40,7 +40,7 @@ import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -94,7 +94,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).actionGet();
|
).actionGet();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getAt(0).getScore(), equalTo(1.0f));
|
assertThat(response.getHits().getAt(0).getScore(), equalTo(1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
searchSource().query(functionScoreQuery(scriptFunction(script))).aggregation(terms("score_agg").script(script))
|
searchSource().query(functionScoreQuery(scriptFunction(script))).aggregation(terms("score_agg").script(script))
|
||||||
)
|
)
|
||||||
).actionGet();
|
).actionGet();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getAt(0).getScore(), equalTo(1.0f));
|
assertThat(response.getHits().getAt(0).getScore(), equalTo(1.0f));
|
||||||
assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getKeyAsString(), equalTo("1.0"));
|
assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getKeyAsString(), equalTo("1.0"));
|
||||||
assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getDocCount(), is(1L));
|
assertThat(((Terms) response.getAggregations().asMap().get("score_agg")).getBuckets().get(0).getDocCount(), is(1L));
|
||||||
|
@ -201,7 +201,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertMinScoreSearchResponses(int numDocs, SearchResponse searchResponse, int numMatchingDocs) {
|
protected void assertMinScoreSearchResponses(int numDocs, SearchResponse searchResponse, int numMatchingDocs) {
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat((int) searchResponse.getHits().getTotalHits().value, is(numMatchingDocs));
|
assertThat((int) searchResponse.getHits().getTotalHits().value, is(numMatchingDocs));
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int hitId = numDocs - 1; (numDocs - hitId) < searchResponse.getHits().getTotalHits().value; hitId--) {
|
for (int hitId = numDocs - 1; (numDocs - hitId) < searchResponse.getHits().getTotalHits().value; hitId--) {
|
||||||
|
@ -219,7 +219,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
SearchResponse termQuery = client().search(
|
SearchResponse termQuery = client().search(
|
||||||
new SearchRequest(new String[] {}).source(searchSource().explain(true).query(termQuery("text", "text")))
|
new SearchRequest(new String[] {}).source(searchSource().explain(true).query(termQuery("text", "text")))
|
||||||
).get();
|
).get();
|
||||||
assertSearchResponse(termQuery);
|
assertNoFailures(termQuery);
|
||||||
assertThat(termQuery.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(termQuery.getHits().getTotalHits().value, equalTo(1L));
|
||||||
float termQueryScore = termQuery.getHits().getAt(0).getScore();
|
float termQueryScore = termQuery.getHits().getAt(0).getScore();
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
searchSource().explain(true).query(functionScoreQuery(termQuery("text", "text")).boostMode(boostMode).setMinScore(0.1f))
|
searchSource().explain(true).query(functionScoreQuery(termQuery("text", "text")).boostMode(boostMode).setMinScore(0.1f))
|
||||||
)
|
)
|
||||||
).get();
|
).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(response.getHits().getAt(0).getScore(), equalTo(expectedScore));
|
assertThat(response.getHits().getAt(0).getScore(), equalTo(expectedScore));
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ public class FunctionScoreIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
).get();
|
).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(0L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(0L));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFirs
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFourthHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFourthHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThirdHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThirdHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
||||||
|
@ -85,7 +84,7 @@ public class QueryRescorerIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
.setSize(randomIntBetween(2, 10))
|
.setSize(randomIntBetween(2, 10))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertFirstHit(searchResponse, hasScore(100.f));
|
assertFirstHit(searchResponse, hasScore(100.f));
|
||||||
int numDocsWith100AsAScore = 0;
|
int numDocsWith100AsAScore = 0;
|
||||||
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
@ -164,7 +164,7 @@ public class GeoPointScriptDocValuesIT extends ESSingleNodeTestCase {
|
||||||
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
||||||
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
final double qLat = GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(lat));
|
final double qLat = GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(lat));
|
||||||
final double qLon = GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(lon));
|
final double qLon = GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(lon));
|
||||||
|
@ -208,7 +208,7 @@ public class GeoPointScriptDocValuesIT extends ESSingleNodeTestCase {
|
||||||
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
||||||
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
lats[i] = GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(lats[i]));
|
lats[i] = GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(lats[i]));
|
||||||
|
@ -247,7 +247,7 @@ public class GeoPointScriptDocValuesIT extends ESSingleNodeTestCase {
|
||||||
.addScriptField("height", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "height", Collections.emptyMap()))
|
.addScriptField("height", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "height", Collections.emptyMap()))
|
||||||
.addScriptField("width", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "width", Collections.emptyMap()))
|
.addScriptField("width", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "width", Collections.emptyMap()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
||||||
assertThat(fields.get("lat").getValue(), equalTo(Double.NaN));
|
assertThat(fields.get("lat").getValue(), equalTo(Double.NaN));
|
||||||
|
|
|
@ -43,7 +43,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFa
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertRequestBuilderThrows;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertRequestBuilderThrows;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.instanceOf;
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
@ -609,7 +608,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.maxQueryTerms(max_query_terms)
|
.maxQueryTerms(max_query_terms)
|
||||||
.minimumShouldMatch("0%");
|
.minimumShouldMatch("0%");
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, max_query_terms);
|
assertHitCount(response, max_query_terms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -642,7 +641,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.minimumShouldMatch(minimumShouldMatch);
|
.minimumShouldMatch(minimumShouldMatch);
|
||||||
logger.info("Testing with minimum_should_match = {}", minimumShouldMatch);
|
logger.info("Testing with minimum_should_match = {}", minimumShouldMatch);
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
if (minimumShouldMatch.equals("0%")) {
|
if (minimumShouldMatch.equals("0%")) {
|
||||||
assertHitCount(response, 10);
|
assertHitCount(response, 10);
|
||||||
} else {
|
} else {
|
||||||
|
@ -672,7 +671,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.maxQueryTerms(100)
|
.maxQueryTerms(100)
|
||||||
.minimumShouldMatch("100%"); // strict all terms must match!
|
.minimumShouldMatch("100%"); // strict all terms must match!
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,14 +697,14 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.minDocFreq(0)
|
.minDocFreq(0)
|
||||||
.minimumShouldMatch("0%");
|
.minimumShouldMatch("0%");
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 0);
|
assertHitCount(response, 0);
|
||||||
|
|
||||||
logger.info("Checking with an empty document ...");
|
logger.info("Checking with an empty document ...");
|
||||||
XContentBuilder emptyDoc = jsonBuilder().startObject().endObject();
|
XContentBuilder emptyDoc = jsonBuilder().startObject().endObject();
|
||||||
mltQuery = moreLikeThisQuery(null, new Item[] { new Item("test", emptyDoc) }).minTermFreq(0).minDocFreq(0).minimumShouldMatch("0%");
|
mltQuery = moreLikeThisQuery(null, new Item[] { new Item("test", emptyDoc) }).minTermFreq(0).minDocFreq(0).minimumShouldMatch("0%");
|
||||||
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 0);
|
assertHitCount(response, 0);
|
||||||
|
|
||||||
logger.info("Checking the document matches otherwise ...");
|
logger.info("Checking the document matches otherwise ...");
|
||||||
|
@ -717,7 +716,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.minDocFreq(0)
|
.minDocFreq(0)
|
||||||
.minimumShouldMatch("100%"); // strict all terms must match but date is ignored
|
.minimumShouldMatch("100%"); // strict all terms must match but date is ignored
|
||||||
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +745,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.maxQueryTerms(100)
|
.maxQueryTerms(100)
|
||||||
.minimumShouldMatch("0%");
|
.minimumShouldMatch("0%");
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, numFields);
|
assertHitCount(response, numFields);
|
||||||
|
|
||||||
logger.info("Now check like this doc, but ignore one doc in the index, then two and so on...");
|
logger.info("Now check like this doc, but ignore one doc in the index, then two and so on...");
|
||||||
|
@ -761,7 +760,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.minimumShouldMatch("0%");
|
.minimumShouldMatch("0%");
|
||||||
|
|
||||||
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, numFields - (i + 1));
|
assertHitCount(response, numFields - (i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -785,7 +784,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.include(true)
|
.include(true)
|
||||||
.minimumShouldMatch("1%");
|
.minimumShouldMatch("1%");
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
SearchResponse response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 2);
|
assertHitCount(response, 2);
|
||||||
|
|
||||||
mltQuery = moreLikeThisQuery(new String[] { "text" }, null, new Item[] { new Item("test", "1") }).minTermFreq(0)
|
mltQuery = moreLikeThisQuery(new String[] { "text" }, null, new Item[] { new Item("test", "1") }).minTermFreq(0)
|
||||||
|
@ -793,7 +792,7 @@ public class MoreLikeThisIT extends ESIntegTestCase {
|
||||||
.include(true)
|
.include(true)
|
||||||
.minimumShouldMatch("1%");
|
.minimumShouldMatch("1%");
|
||||||
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
response = client().prepareSearch("test").setQuery(mltQuery).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import static org.elasticsearch.test.ListMatcher.matchesList;
|
||||||
import static org.elasticsearch.test.MapMatcher.assertMap;
|
import static org.elasticsearch.test.MapMatcher.assertMap;
|
||||||
import static org.elasticsearch.test.MapMatcher.matchesMap;
|
import static org.elasticsearch.test.MapMatcher.matchesMap;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -127,7 +127,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
.setProfile(true)
|
.setProfile(true)
|
||||||
.addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L))
|
.addAggregation(histogram("histo").field(NUMBER_FIELD).interval(1L))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
||||||
|
@ -171,7 +171,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
||||||
|
@ -258,7 +258,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
||||||
|
@ -329,7 +329,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
.subAggregation(max("max").field(NUMBER_FIELD))
|
.subAggregation(max("max").field(NUMBER_FIELD))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
||||||
|
@ -398,7 +398,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("idx").numPrimaries));
|
||||||
|
@ -615,7 +615,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(0));
|
assertThat(profileResults.size(), equalTo(0));
|
||||||
|
@ -652,7 +652,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
.subAggregation(new MaxAggregationBuilder("m").field("date"))
|
.subAggregation(new MaxAggregationBuilder("m").field("date"))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("dateidx").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("dateidx").numPrimaries));
|
||||||
|
@ -724,7 +724,7 @@ public class AggregationProfilerIT extends ESIntegTestCase {
|
||||||
.setProfile(true)
|
.setProfile(true)
|
||||||
.addAggregation(new DateHistogramAggregationBuilder("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
.addAggregation(new DateHistogramAggregationBuilder("histo").field("date").calendarInterval(DateHistogramInterval.MONTH))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
Map<String, SearchProfileShardResult> profileResults = response.getProfileResults();
|
||||||
assertThat(profileResults, notNullValue());
|
assertThat(profileResults, notNullValue());
|
||||||
assertThat(profileResults.size(), equalTo(getNumShards("date_filter_by_filter_disabled").numPrimaries));
|
assertThat(profileResults.size(), equalTo(getNumShards("date_filter_by_filter_disabled").numPrimaries));
|
||||||
|
|
|
@ -31,7 +31,6 @@ import static java.util.Collections.singletonMap;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
|
|
||||||
public class ExistsIT extends ESIntegTestCase {
|
public class ExistsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
|
@ -115,14 +114,14 @@ public class ExistsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
final long numDocs = sources.length;
|
final long numDocs = sources.length;
|
||||||
SearchResponse allDocs = client().prepareSearch("idx").setSize(sources.length).get();
|
SearchResponse allDocs = client().prepareSearch("idx").setSize(sources.length).get();
|
||||||
assertSearchResponse(allDocs);
|
assertNoFailures(allDocs);
|
||||||
assertHitCount(allDocs, numDocs);
|
assertHitCount(allDocs, numDocs);
|
||||||
for (Map.Entry<String, Integer> entry : expected.entrySet()) {
|
for (Map.Entry<String, Integer> entry : expected.entrySet()) {
|
||||||
final String fieldName = entry.getKey();
|
final String fieldName = entry.getKey();
|
||||||
final int count = entry.getValue();
|
final int count = entry.getValue();
|
||||||
// exists
|
// exists
|
||||||
SearchResponse resp = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).get();
|
SearchResponse resp = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
try {
|
try {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
String.format(
|
String.format(
|
||||||
|
@ -201,7 +200,7 @@ public class ExistsIT extends ESIntegTestCase {
|
||||||
int expectedCount = entry.getValue();
|
int expectedCount = entry.getValue();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).get();
|
SearchResponse response = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery(fieldName)).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, expectedCount);
|
assertHitCount(response, expectedCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +232,7 @@ public class ExistsIT extends ESIntegTestCase {
|
||||||
indexRandom(true, false, indexRequests);
|
indexRandom(true, false, indexRequests);
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery("foo-alias")).get();
|
SearchResponse response = client().prepareSearch("idx").setQuery(QueryBuilders.existsQuery("foo-alias")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 2);
|
assertHitCount(response, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,10 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFirstHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFirstHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasScore;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasScore;
|
||||||
|
@ -452,9 +452,10 @@ public class SearchQueryIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SearchResponse request = client().prepareSearch().setQuery(constantScoreQuery(termsQuery("_index", indexNames))).get();
|
assertHitCountAndNoFailures(
|
||||||
SearchResponse searchResponse = assertSearchResponse(request);
|
client().prepareSearch().setQuery(constantScoreQuery(termsQuery("_index", indexNames))),
|
||||||
assertHitCount(searchResponse, indexNames.length);
|
indexNames.length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFa
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertRequestBuilderThrows;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertRequestBuilderThrows;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -517,7 +516,7 @@ public class SearchScrollIT extends ESIntegTestCase {
|
||||||
assertSearchHits(response, "1");
|
assertSearchHits(response, "1");
|
||||||
|
|
||||||
response = client().prepareSearchScroll(response.getScrollId()).get();
|
response = client().prepareSearchScroll(response.getScrollId()).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
assertNoSearchHits(response);
|
assertNoSearchHits(response);
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ import static org.elasticsearch.index.query.QueryBuilders.rangeQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -190,29 +191,25 @@ public class SimpleSearchIT extends ESIntegTestCase {
|
||||||
client().prepareIndex("test").setId("3").setSource("field", "1967-01-01T00:00").get();
|
client().prepareIndex("test").setId("3").setSource("field", "1967-01-01T00:00").get();
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
refresh();
|
refresh();
|
||||||
SearchResponse searchResponse = client().prepareSearch("test")
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-03||+2d").lte("2010-01-04||+2d/d"))
|
client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-03||+2d").lte("2010-01-04||+2d/d")),
|
||||||
.get();
|
2L
|
||||||
assertNoFailures(searchResponse);
|
);
|
||||||
assertHitCount(searchResponse, 2L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test")
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lte("2010-01-06T02:00"))
|
client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lte("2010-01-06T02:00")),
|
||||||
.get();
|
2L
|
||||||
assertNoFailures(searchResponse);
|
);
|
||||||
assertHitCount(searchResponse, 2L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test")
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lt("2010-01-06T02:00"))
|
client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("2010-01-05T02:00").lt("2010-01-06T02:00")),
|
||||||
.get();
|
1L
|
||||||
assertNoFailures(searchResponse);
|
);
|
||||||
assertHitCount(searchResponse, 1L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test")
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(QueryBuilders.rangeQuery("field").gt("2010-01-05T02:00").lt("2010-01-06T02:00"))
|
client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("2010-01-05T02:00").lt("2010-01-06T02:00")),
|
||||||
.get();
|
0L
|
||||||
assertNoFailures(searchResponse);
|
);
|
||||||
assertHitCount(searchResponse, 0L);
|
|
||||||
|
|
||||||
assertHitCount(
|
assertHitCount(
|
||||||
client().prepareSearch("test").setQuery(QueryBuilders.queryStringQuery("field:[2010-01-03||+2d TO 2010-01-04||+2d/d]")),
|
client().prepareSearch("test").setQuery(QueryBuilders.queryStringQuery("field:[2010-01-03||+2d TO 2010-01-04||+2d/d]")),
|
||||||
|
@ -220,12 +217,10 @@ public class SimpleSearchIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
// a string value of "1000" should be parsed as the year 1000 and return all three docs
|
// a string value of "1000" should be parsed as the year 1000 and return all three docs
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("1000")).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("1000")), 3L);
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 3L);
|
|
||||||
|
|
||||||
// a numeric value of 1000 should be parsed as 1000 millis since epoch and return only docs after 1970
|
// a numeric value of 1000 should be parsed as 1000 millis since epoch and return only docs after 1970
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt(1000)).get();
|
SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt(1000)).get();
|
||||||
assertNoFailures(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertHitCount(searchResponse, 2L);
|
assertHitCount(searchResponse, 2L);
|
||||||
String[] expectedIds = new String[] { "1", "2" };
|
String[] expectedIds = new String[] { "1", "2" };
|
||||||
|
@ -245,37 +240,14 @@ public class SimpleSearchIT extends ESIntegTestCase {
|
||||||
ensureGreen();
|
ensureGreen();
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
SearchResponse searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("A").lte("B")).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("A").lte("B")), 2L);
|
||||||
assertNoFailures(searchResponse);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("A").lte("B")), 1L);
|
||||||
assertHitCount(searchResponse, 2L);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("A").lt("B")), 1L);
|
||||||
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte(null).lt("C")), 3L);
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("A").lte("B")).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("B").lt(null)), 2L);
|
||||||
assertNoFailures(searchResponse);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt(null).lt(null)), 4L);
|
||||||
assertHitCount(searchResponse, 1L);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("").lt(null)), 4L);
|
||||||
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("").lt(null)), 3L);
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("A").lt("B")).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 1L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte(null).lt("C")).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 3L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("B").lt(null)).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 2L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt(null).lt(null)).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 4L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gte("").lt(null)).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 4L);
|
|
||||||
|
|
||||||
searchResponse = client().prepareSearch("test").setQuery(QueryBuilders.rangeQuery("field").gt("").lt(null)).get();
|
|
||||||
assertNoFailures(searchResponse);
|
|
||||||
assertHitCount(searchResponse, 3L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleTerminateAfterCount() throws Exception {
|
public void testSimpleTerminateAfterCount() throws Exception {
|
||||||
|
|
|
@ -63,7 +63,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFirstHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFirstHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSecondHit;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
|
@ -126,7 +125,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.setSize(10)
|
.setSize(10)
|
||||||
.get();
|
.get();
|
||||||
logClusterState();
|
logClusterState();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
for (int j = 1; j < searchResponse.getHits().getHits().length; j++) {
|
for (int j = 1; j < searchResponse.getHits().getHits().length; j++) {
|
||||||
Number current = (Number) searchResponse.getHits().getHits()[j].getSourceAsMap().get("entry");
|
Number current = (Number) searchResponse.getHits().getHits()[j].getSourceAsMap().get("entry");
|
||||||
|
@ -140,7 +139,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.setSize(10)
|
.setSize(10)
|
||||||
.get();
|
.get();
|
||||||
logClusterState();
|
logClusterState();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
for (int j = 1; j < searchResponse.getHits().getHits().length; j++) {
|
for (int j = 1; j < searchResponse.getHits().getHits().length; j++) {
|
||||||
Number current = (Number) searchResponse.getHits().getHits()[j].getSourceAsMap().get("entry");
|
Number current = (Number) searchResponse.getHits().getHits()[j].getSourceAsMap().get("entry");
|
||||||
|
@ -184,7 +183,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.addSort(new FieldSortBuilder("timeUpdated").order(SortOrder.ASC).unmappedType("date"))
|
.addSort(new FieldSortBuilder("timeUpdated").order(SortOrder.ASC).unmappedType("date"))
|
||||||
.setSize(docs)
|
.setSize(docs)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(allDocsResponse);
|
assertNoFailures(allDocsResponse);
|
||||||
|
|
||||||
final int numiters = randomIntBetween(1, 20);
|
final int numiters = randomIntBetween(1, 20);
|
||||||
for (int i = 0; i < numiters; i++) {
|
for (int i = 0; i < numiters; i++) {
|
||||||
|
@ -197,7 +196,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.addSort(new FieldSortBuilder("timeUpdated").order(SortOrder.ASC).unmappedType("date"))
|
.addSort(new FieldSortBuilder("timeUpdated").order(SortOrder.ASC).unmappedType("date"))
|
||||||
.setSize(scaledRandomIntBetween(1, docs))
|
.setSize(scaledRandomIntBetween(1, docs))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
for (int j = 0; j < searchResponse.getHits().getHits().length; j++) {
|
for (int j = 0; j < searchResponse.getHits().getHits().length; j++) {
|
||||||
assertThat(
|
assertThat(
|
||||||
searchResponse.toString() + "\n vs. \n" + allDocsResponse.toString(),
|
searchResponse.toString() + "\n vs. \n" + allDocsResponse.toString(),
|
||||||
|
@ -1765,13 +1764,13 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
);
|
);
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").addSort(SortBuilders.fieldSort("ip")).get();
|
SearchResponse response = client().prepareSearch("test").addSort(SortBuilders.fieldSort("ip")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertEquals(2, response.getHits().getTotalHits().value);
|
assertEquals(2, response.getHits().getTotalHits().value);
|
||||||
assertArrayEquals(new String[] { "192.168.1.7" }, response.getHits().getAt(0).getSortValues());
|
assertArrayEquals(new String[] { "192.168.1.7" }, response.getHits().getAt(0).getSortValues());
|
||||||
assertArrayEquals(new String[] { "2001:db8::ff00:42:8329" }, response.getHits().getAt(1).getSortValues());
|
assertArrayEquals(new String[] { "2001:db8::ff00:42:8329" }, response.getHits().getAt(1).getSortValues());
|
||||||
|
|
||||||
response = client().prepareSearch("test").addSort(SortBuilders.fieldSort("ip")).searchAfter(new Object[] { "192.168.1.7" }).get();
|
response = client().prepareSearch("test").addSort(SortBuilders.fieldSort("ip")).searchAfter(new Object[] { "192.168.1.7" }).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertEquals(2, response.getHits().getTotalHits().value);
|
assertEquals(2, response.getHits().getTotalHits().value);
|
||||||
assertEquals(1, response.getHits().getHits().length);
|
assertEquals(1, response.getHits().getHits().length);
|
||||||
assertArrayEquals(new String[] { "2001:db8::ff00:42:8329" }, response.getHits().getAt(0).getSortValues());
|
assertArrayEquals(new String[] { "2001:db8::ff00:42:8329" }, response.getHits().getAt(0).getSortValues());
|
||||||
|
@ -2080,7 +2079,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.addSort(new FieldSortBuilder("long_field").order(SortOrder.DESC))
|
.addSort(new FieldSortBuilder("long_field").order(SortOrder.DESC))
|
||||||
.setSize(10)
|
.setSize(10)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
long previousLong = Long.MAX_VALUE;
|
long previousLong = Long.MAX_VALUE;
|
||||||
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
||||||
// check the correct sort order
|
// check the correct sort order
|
||||||
|
@ -2092,7 +2091,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
|
|
||||||
// *** 2. sort ASC on long_field
|
// *** 2. sort ASC on long_field
|
||||||
searchResponse = client().prepareSearch().addSort(new FieldSortBuilder("long_field").order(SortOrder.ASC)).setSize(10).get();
|
searchResponse = client().prepareSearch().addSort(new FieldSortBuilder("long_field").order(SortOrder.ASC)).setSize(10).get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
previousLong = Long.MIN_VALUE;
|
previousLong = Long.MIN_VALUE;
|
||||||
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
for (int i = 0; i < searchResponse.getHits().getHits().length; i++) {
|
||||||
// check the correct sort order
|
// check the correct sort order
|
||||||
|
@ -2120,7 +2119,7 @@ public class FieldSortIT extends ESIntegTestCase {
|
||||||
.addSort(new FieldSortBuilder("foo"))
|
.addSort(new FieldSortBuilder("foo"))
|
||||||
.setSize(10)
|
.setSize(10)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
String errMsg = "Can't sort on field [foo]; the field has incompatible sort types";
|
String errMsg = "Can't sort on field [foo]; the field has incompatible sort types";
|
||||||
|
|
|
@ -39,7 +39,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -193,7 +193,7 @@ public class SearchStatsIT extends ESIntegTestCase {
|
||||||
.setSize(size)
|
.setSize(size)
|
||||||
.setScroll(TimeValue.timeValueMinutes(2))
|
.setScroll(TimeValue.timeValueMinutes(2))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
// refresh the stats now that scroll contexts are opened
|
// refresh the stats now that scroll contexts are opened
|
||||||
indicesStats = indicesAdmin().prepareStats(index).get();
|
indicesStats = indicesAdmin().prepareStats(index).get();
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.rest.RestStatus;
|
||||||
import org.elasticsearch.test.ESSingleNodeTestCase;
|
import org.elasticsearch.test.ESSingleNodeTestCase;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.anyOf;
|
import static org.hamcrest.Matchers.anyOf;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public class FieldStatsProviderRefreshTests extends ESSingleNodeTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r1);
|
assertNoFailures(r1);
|
||||||
assertThat(r1.getHits().getTotalHits().value, equalTo(3L));
|
assertThat(r1.getHits().getTotalHits().value, equalTo(3L));
|
||||||
assertRequestCacheStats(0, 1);
|
assertRequestCacheStats(0, 1);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public class FieldStatsProviderRefreshTests extends ESSingleNodeTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r2);
|
assertNoFailures(r2);
|
||||||
assertThat(r2.getHits().getTotalHits().value, equalTo(3L));
|
assertThat(r2.getHits().getTotalHits().value, equalTo(3L));
|
||||||
assertRequestCacheStats(1, 1);
|
assertRequestCacheStats(1, 1);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class FieldStatsProviderRefreshTests extends ESSingleNodeTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
.setQuery(QueryBuilders.rangeQuery("s").gte("a").lte("g"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r3);
|
assertNoFailures(r3);
|
||||||
assertThat(r3.getHits().getTotalHits().value, equalTo(5L));
|
assertThat(r3.getHits().getTotalHits().value, equalTo(5L));
|
||||||
assertRequestCacheStats(1, 2);
|
assertRequestCacheStats(1, 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,9 @@ import static org.elasticsearch.index.query.QueryBuilders.simpleQueryStringQuery
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertOrderedSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.hamcrest.CoreMatchers.startsWith;
|
import static org.hamcrest.CoreMatchers.startsWith;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
@ -131,17 +131,12 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(queryStringQuery("flattened.field1:value")).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(queryStringQuery("flattened.field1:value")), 1);
|
||||||
assertSearchResponse(response);
|
assertHitCountAndNoFailures(
|
||||||
assertHitCount(response, 1);
|
client().prepareSearch("test").setQuery(queryStringQuery("flattened.field1:value AND flattened:2.718")),
|
||||||
|
1
|
||||||
response = client().prepareSearch("test").setQuery(queryStringQuery("flattened.field1:value AND flattened:2.718")).get();
|
);
|
||||||
assertSearchResponse(response);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(queryStringQuery("2.718").field("flattened.field2")), 1);
|
||||||
assertHitCount(response, 1);
|
|
||||||
|
|
||||||
response = client().prepareSearch("test").setQuery(queryStringQuery("2.718").field("flattened.field2")).get();
|
|
||||||
assertSearchResponse(response);
|
|
||||||
assertHitCount(response, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleQueryStringQuery() throws Exception {
|
public void testSimpleQueryStringQuery() throws Exception {
|
||||||
|
@ -159,17 +154,9 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").setQuery(simpleQueryStringQuery("value").field("flattened.field1")).get();
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(simpleQueryStringQuery("value").field("flattened.field1")), 1);
|
||||||
assertSearchResponse(response);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(simpleQueryStringQuery("+value +2.718").field("flattened")), 1);
|
||||||
assertHitCount(response, 1);
|
assertHitCountAndNoFailures(client().prepareSearch("test").setQuery(simpleQueryStringQuery("+value +3.141").field("flattened")), 0);
|
||||||
|
|
||||||
response = client().prepareSearch("test").setQuery(simpleQueryStringQuery("+value +2.718").field("flattened")).get();
|
|
||||||
assertSearchResponse(response);
|
|
||||||
assertHitCount(response, 1);
|
|
||||||
|
|
||||||
response = client().prepareSearch("test").setQuery(simpleQueryStringQuery("+value +3.141").field("flattened")).get();
|
|
||||||
assertSearchResponse(response);
|
|
||||||
assertHitCount(response, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExists() throws Exception {
|
public void testExists() throws Exception {
|
||||||
|
@ -226,7 +213,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened"))
|
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Cardinality count = response.getAggregations().get("cardinality");
|
Cardinality count = response.getAggregations().get("cardinality");
|
||||||
assertCardinality(count, numDocs, precisionThreshold);
|
assertCardinality(count, numDocs, precisionThreshold);
|
||||||
|
|
||||||
|
@ -234,7 +221,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
SearchResponse firstResponse = client().prepareSearch("test")
|
SearchResponse firstResponse = client().prepareSearch("test")
|
||||||
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened.first"))
|
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened.first"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(firstResponse);
|
assertNoFailures(firstResponse);
|
||||||
|
|
||||||
Cardinality firstCount = firstResponse.getAggregations().get("cardinality");
|
Cardinality firstCount = firstResponse.getAggregations().get("cardinality");
|
||||||
assertCardinality(firstCount, numDocs, precisionThreshold);
|
assertCardinality(firstCount, numDocs, precisionThreshold);
|
||||||
|
@ -242,7 +229,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
SearchResponse secondResponse = client().prepareSearch("test")
|
SearchResponse secondResponse = client().prepareSearch("test")
|
||||||
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened.second"))
|
.addAggregation(cardinality("cardinality").precisionThreshold(precisionThreshold).field("flattened.second"))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(secondResponse);
|
assertNoFailures(secondResponse);
|
||||||
|
|
||||||
Cardinality secondCount = secondResponse.getAggregations().get("cardinality");
|
Cardinality secondCount = secondResponse.getAggregations().get("cardinality");
|
||||||
assertCardinality(secondCount, (numDocs + 1) / 2, precisionThreshold);
|
assertCardinality(secondCount, (numDocs + 1) / 2, precisionThreshold);
|
||||||
|
@ -281,7 +268,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
// Aggregate on the root 'labels' field.
|
// Aggregate on the root 'labels' field.
|
||||||
TermsAggregationBuilder builder = createTermsAgg("labels");
|
TermsAggregationBuilder builder = createTermsAgg("labels");
|
||||||
SearchResponse response = client().prepareSearch("test").addAggregation(builder).get();
|
SearchResponse response = client().prepareSearch("test").addAggregation(builder).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -299,7 +286,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
// Aggregate on the 'priority' subfield.
|
// Aggregate on the 'priority' subfield.
|
||||||
TermsAggregationBuilder priorityAgg = createTermsAgg("labels.priority");
|
TermsAggregationBuilder priorityAgg = createTermsAgg("labels.priority");
|
||||||
SearchResponse priorityResponse = client().prepareSearch("test").addAggregation(priorityAgg).get();
|
SearchResponse priorityResponse = client().prepareSearch("test").addAggregation(priorityAgg).get();
|
||||||
assertSearchResponse(priorityResponse);
|
assertNoFailures(priorityResponse);
|
||||||
|
|
||||||
Terms priorityTerms = priorityResponse.getAggregations().get("terms");
|
Terms priorityTerms = priorityResponse.getAggregations().get("terms");
|
||||||
assertThat(priorityTerms, notNullValue());
|
assertThat(priorityTerms, notNullValue());
|
||||||
|
@ -313,7 +300,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
// Aggregate on the 'release' subfield.
|
// Aggregate on the 'release' subfield.
|
||||||
TermsAggregationBuilder releaseAgg = createTermsAgg("labels.release");
|
TermsAggregationBuilder releaseAgg = createTermsAgg("labels.release");
|
||||||
SearchResponse releaseResponse = client().prepareSearch("test").addAggregation(releaseAgg).get();
|
SearchResponse releaseResponse = client().prepareSearch("test").addAggregation(releaseAgg).get();
|
||||||
assertSearchResponse(releaseResponse);
|
assertNoFailures(releaseResponse);
|
||||||
|
|
||||||
Terms releaseTerms = releaseResponse.getAggregations().get("terms");
|
Terms releaseTerms = releaseResponse.getAggregations().get("terms");
|
||||||
assertThat(releaseTerms, notNullValue());
|
assertThat(releaseTerms, notNullValue());
|
||||||
|
@ -328,7 +315,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
// Aggregate on the 'priority' subfield with a min_doc_count of 0.
|
// Aggregate on the 'priority' subfield with a min_doc_count of 0.
|
||||||
TermsAggregationBuilder minDocCountAgg = createTermsAgg("labels.priority").minDocCount(0);
|
TermsAggregationBuilder minDocCountAgg = createTermsAgg("labels.priority").minDocCount(0);
|
||||||
SearchResponse minDocCountResponse = client().prepareSearch("test").addAggregation(minDocCountAgg).get();
|
SearchResponse minDocCountResponse = client().prepareSearch("test").addAggregation(minDocCountAgg).get();
|
||||||
assertSearchResponse(minDocCountResponse);
|
assertNoFailures(minDocCountResponse);
|
||||||
|
|
||||||
Terms minDocCountTerms = minDocCountResponse.getAggregations().get("terms");
|
Terms minDocCountTerms = minDocCountResponse.getAggregations().get("terms");
|
||||||
assertThat(minDocCountTerms, notNullValue());
|
assertThat(minDocCountTerms, notNullValue());
|
||||||
|
@ -359,7 +346,7 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").addDocValueField("flattened").addDocValueField("flattened.key").get();
|
SearchResponse response = client().prepareSearch("test").addDocValueField("flattened").addDocValueField("flattened.key").get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 1);
|
assertHitCount(response, 1);
|
||||||
|
|
||||||
Map<String, DocumentField> fields = response.getHits().getAt(0).getFields();
|
Map<String, DocumentField> fields = response.getHits().getAt(0).getFields();
|
||||||
|
@ -409,17 +396,17 @@ public class FlattenedFieldSearchTests extends ESSingleNodeTestCase {
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch("test").addSort("flattened", SortOrder.DESC).get();
|
SearchResponse response = client().prepareSearch("test").addSort("flattened", SortOrder.DESC).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 3);
|
assertHitCount(response, 3);
|
||||||
assertOrderedSearchHits(response, "3", "1", "2");
|
assertOrderedSearchHits(response, "3", "1", "2");
|
||||||
|
|
||||||
response = client().prepareSearch("test").addSort("flattened.key", SortOrder.DESC).get();
|
response = client().prepareSearch("test").addSort("flattened.key", SortOrder.DESC).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 3);
|
assertHitCount(response, 3);
|
||||||
assertOrderedSearchHits(response, "2", "1", "3");
|
assertOrderedSearchHits(response, "2", "1", "3");
|
||||||
|
|
||||||
response = client().prepareSearch("test").addSort(new FieldSortBuilder("flattened.key").order(SortOrder.DESC).missing("Z")).get();
|
response = client().prepareSearch("test").addSort(new FieldSortBuilder("flattened.key").order(SortOrder.DESC).missing("Z")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertHitCount(response, 3);
|
assertHitCount(response, 3);
|
||||||
assertOrderedSearchHits(response, "3", "2", "1");
|
assertOrderedSearchHits(response, "3", "2", "1");
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
|
|
||||||
|
@ -79,11 +79,11 @@ public abstract class ShardSizeTestCase extends ESIntegTestCase {
|
||||||
indexRandom(true, docs);
|
indexRandom(true, docs);
|
||||||
|
|
||||||
SearchResponse resp = client().prepareSearch("idx").setRouting(routing1).setQuery(matchAllQuery()).get();
|
SearchResponse resp = client().prepareSearch("idx").setRouting(routing1).setQuery(matchAllQuery()).get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
long totalOnOne = resp.getHits().getTotalHits().value;
|
long totalOnOne = resp.getHits().getTotalHits().value;
|
||||||
assertThat(totalOnOne, is(15L));
|
assertThat(totalOnOne, is(15L));
|
||||||
resp = client().prepareSearch("idx").setRouting(routing2).setQuery(matchAllQuery()).get();
|
resp = client().prepareSearch("idx").setRouting(routing2).setQuery(matchAllQuery()).get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
long totalOnTwo = resp.getHits().getTotalHits().value;
|
long totalOnTwo = resp.getHits().getTotalHits().value;
|
||||||
assertThat(totalOnTwo, is(12L));
|
assertThat(totalOnTwo, is(12L));
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.signific
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.ESIntegTestCase.client;
|
import static org.elasticsearch.test.ESIntegTestCase.client;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
public class SharedSignificantTermsTestMethods {
|
public class SharedSignificantTermsTestMethods {
|
||||||
|
@ -51,7 +51,7 @@ public class SharedSignificantTermsTestMethods {
|
||||||
.addAggregation(terms("class").field(CLASS_FIELD).subAggregation(significantTerms("sig_terms").field(TEXT_FIELD)))
|
.addAggregation(terms("class").field(CLASS_FIELD).subAggregation(significantTerms("sig_terms").field(TEXT_FIELD)))
|
||||||
.execute()
|
.execute()
|
||||||
.actionGet();
|
.actionGet();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
StringTerms classes = response.getAggregations().get("class");
|
StringTerms classes = response.getAggregations().get("class");
|
||||||
Assert.assertThat(classes.getBuckets().size(), equalTo(2));
|
Assert.assertThat(classes.getBuckets().size(), equalTo(2));
|
||||||
for (Terms.Bucket classBucket : classes.getBuckets()) {
|
for (Terms.Bucket classBucket : classes.getBuckets()) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde
|
||||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.ExecutionMode;
|
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory.ExecutionMode;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
|
|
||||||
public abstract class AbstractTermsTestCase extends ESIntegTestCase {
|
public abstract class AbstractTermsTestCase extends ESIntegTestCase {
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public abstract class AbstractTermsTestCase extends ESIntegTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(allTerms);
|
assertNoFailures(allTerms);
|
||||||
|
|
||||||
Terms terms = allTerms.getAggregations().get("terms");
|
Terms terms = allTerms.getAggregations().get("terms");
|
||||||
assertEquals(0, terms.getSumOfOtherDocCounts()); // size is 0
|
assertEquals(0, terms.getSumOfOtherDocCounts()); // size is 0
|
||||||
|
@ -59,7 +59,7 @@ public abstract class AbstractTermsTestCase extends ESIntegTestCase {
|
||||||
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
.collectMode(randomFrom(SubAggCollectionMode.values()))
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(resp);
|
assertNoFailures(resp);
|
||||||
terms = resp.getAggregations().get("terms");
|
terms = resp.getAggregations().get("terms");
|
||||||
assertEquals(Math.min(size, totalNumTerms), terms.getBuckets().size());
|
assertEquals(Math.min(size, totalNumTerms), terms.getBuckets().size());
|
||||||
assertEquals(sumOfDocCounts, sumOfDocCounts(terms));
|
assertEquals(sumOfDocCounts, sumOfDocCounts(terms));
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ public abstract class AbstractGeoTestCase extends ESIntegTestCase {
|
||||||
.addSort(SortBuilders.fieldSort(NUMBER_FIELD_NAME).order(SortOrder.ASC))
|
.addSort(SortBuilders.fieldSort(NUMBER_FIELD_NAME).order(SortOrder.ASC))
|
||||||
.setSize(5000)
|
.setSize(5000)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
long totalHits = response.getHits().getTotalHits().value;
|
long totalHits = response.getHits().getTotalHits().value;
|
||||||
XContentBuilder builder = XContentFactory.jsonBuilder();
|
XContentBuilder builder = XContentFactory.jsonBuilder();
|
||||||
ChunkedToXContent.wrapAsToXContent(response).toXContent(builder, ToXContent.EMPTY_PARAMS);
|
ChunkedToXContent.wrapAsToXContent(response).toXContent(builder, ToXContent.EMPTY_PARAMS);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -38,7 +38,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
.setQuery(matchAllQuery())
|
.setQuery(matchAllQuery())
|
||||||
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(0L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(0L));
|
||||||
|
@ -52,7 +52,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
SearchResponse response = client().prepareSearch(UNMAPPED_IDX_NAME)
|
SearchResponse response = client().prepareSearch(UNMAPPED_IDX_NAME)
|
||||||
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
||||||
assertThat(geoCentroid, notNullValue());
|
assertThat(geoCentroid, notNullValue());
|
||||||
|
@ -65,7 +65,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
SearchResponse response = client().prepareSearch(IDX_NAME, UNMAPPED_IDX_NAME)
|
SearchResponse response = client().prepareSearch(IDX_NAME, UNMAPPED_IDX_NAME)
|
||||||
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
||||||
assertThat(geoCentroid, notNullValue());
|
assertThat(geoCentroid, notNullValue());
|
||||||
|
@ -79,7 +79,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
.setQuery(matchAllQuery())
|
.setQuery(matchAllQuery())
|
||||||
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
CentroidAggregation geoCentroid = response.getAggregations().get(aggName());
|
||||||
assertThat(geoCentroid, notNullValue());
|
assertThat(geoCentroid, notNullValue());
|
||||||
|
@ -93,7 +93,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
.setQuery(matchAllQuery())
|
.setQuery(matchAllQuery())
|
||||||
.addAggregation(global("global").subAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME)))
|
.addAggregation(global("global").subAggregation(centroidAgg(aggName()).field(SINGLE_VALUED_FIELD_NAME)))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Global global = response.getAggregations().get("global");
|
Global global = response.getAggregations().get("global");
|
||||||
assertThat(global, notNullValue());
|
assertThat(global, notNullValue());
|
||||||
|
@ -120,7 +120,7 @@ public abstract class CentroidAggregationTestBase extends AbstractGeoTestCase {
|
||||||
.setQuery(matchAllQuery())
|
.setQuery(matchAllQuery())
|
||||||
.addAggregation(centroidAgg(aggName()).field(MULTI_VALUED_FIELD_NAME))
|
.addAggregation(centroidAgg(aggName()).field(MULTI_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
CentroidAggregation geoCentroid = searchResponse.getAggregations().get(aggName());
|
CentroidAggregation geoCentroid = searchResponse.getAggregations().get(aggName());
|
||||||
assertThat(geoCentroid, notNullValue());
|
assertThat(geoCentroid, notNullValue());
|
||||||
|
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.global;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.hamcrest.Matchers.closeTo;
|
import static org.hamcrest.Matchers.closeTo;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.notNullValue;
|
import static org.hamcrest.Matchers.notNullValue;
|
||||||
|
@ -41,7 +41,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
public void testSingleValuedField() throws Exception {
|
public void testSingleValuedField() throws Exception {
|
||||||
SearchResponse response = client().prepareSearch(IDX_NAME).addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)).get();
|
SearchResponse response = client().prepareSearch(IDX_NAME).addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
@ -60,7 +60,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
.addAggregation(global("global").subAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)))
|
.addAggregation(global("global").subAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
|
|
||||||
Global global = searchResponse.getAggregations().get("global");
|
Global global = searchResponse.getAggregations().get("global");
|
||||||
assertThat(global, notNullValue());
|
assertThat(global, notNullValue());
|
||||||
|
@ -100,7 +100,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
public void testMultiValuedField() throws Exception {
|
public void testMultiValuedField() throws Exception {
|
||||||
SearchResponse response = client().prepareSearch(IDX_NAME).addAggregation(boundsAgg(aggName(), MULTI_VALUED_FIELD_NAME)).get();
|
SearchResponse response = client().prepareSearch(IDX_NAME).addAggregation(boundsAgg(aggName(), MULTI_VALUED_FIELD_NAME)).get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
@ -118,7 +118,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
@ -134,7 +134,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
@ -171,7 +171,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
.addAggregation(terms("terms").field(NUMBER_FIELD_NAME).subAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)))
|
.addAggregation(terms("terms").field(NUMBER_FIELD_NAME).subAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME)))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
Terms terms = response.getAggregations().get("terms");
|
Terms terms = response.getAggregations().get("terms");
|
||||||
assertThat(terms, notNullValue());
|
assertThat(terms, notNullValue());
|
||||||
|
@ -194,7 +194,7 @@ public abstract class SpatialBoundsAggregationTestBase<T extends SpatialPoint> e
|
||||||
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
.addAggregation(boundsAgg(aggName(), SINGLE_VALUED_FIELD_NAME))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
SpatialBounds<T> geoBounds = response.getAggregations().get(aggName());
|
||||||
assertThat(geoBounds, notNullValue());
|
assertThat(geoBounds, notNullValue());
|
||||||
|
|
|
@ -47,7 +47,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -115,7 +115,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, geometry).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, geometry).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -123,7 +123,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
// default query, without specifying relation (expect intersects)
|
// default query, without specifying relation (expect intersects)
|
||||||
searchResponse = client().prepareSearch(defaultIndexName).setQuery(queryBuilder().shapeQuery(defaultFieldName, geometry)).get();
|
searchResponse = client().prepareSearch(defaultIndexName).setQuery(queryBuilder().shapeQuery(defaultFieldName, geometry)).get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -181,7 +181,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchHits.getAt(0).getId(), equalTo("1"));
|
assertThat(searchHits.getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -223,7 +223,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
||||||
|
@ -234,7 +234,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.WITHIN))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.WITHIN))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
||||||
|
@ -245,7 +245,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.DISJOINT))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.DISJOINT))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
||||||
|
@ -255,7 +255,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.CONTAINS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, multiPolygon).relation(ShapeRelation.CONTAINS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(0));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(0));
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
||||||
|
@ -341,7 +341,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("point2"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("point2"));
|
||||||
|
@ -354,7 +354,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.indexedShapePath(indexedShapePath)
|
.indexedShapePath(indexedShapePath)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setTrackTotalHits(true)
|
.setTrackTotalHits(true)
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, line).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, line).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo((long) line.length()));
|
assertThat(searchHits.getTotalHits().value, equalTo((long) line.length()));
|
||||||
}
|
}
|
||||||
|
@ -647,7 +647,7 @@ public abstract class BasePointShapeQueryTestCase<T extends AbstractGeometryQuer
|
||||||
.setTrackTotalHits(true)
|
.setTrackTotalHits(true)
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo((long) linearRing.length()));
|
assertThat(searchHits.getTotalHits().value, equalTo((long) linearRing.length()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDI
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -150,28 +150,28 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.indexedShapeIndex("shapes")
|
.indexedShapeIndex("shapes")
|
||||||
.indexedShapePath(defaultFieldName);
|
.indexedShapePath(defaultFieldName);
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
||||||
.relation(ShapeRelation.INTERSECTS)
|
.relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex("shapes")
|
.indexedShapeIndex("shapes")
|
||||||
.indexedShapePath("1.geo");
|
.indexedShapePath("1.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
||||||
.relation(ShapeRelation.INTERSECTS)
|
.relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex("shapes")
|
.indexedShapeIndex("shapes")
|
||||||
.indexedShapePath("1.2.geo");
|
.indexedShapePath("1.2.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
filter = queryBuilder().shapeQuery(defaultFieldName, "1")
|
||||||
.relation(ShapeRelation.INTERSECTS)
|
.relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex("shapes")
|
.indexedShapeIndex("shapes")
|
||||||
.indexedShapePath("1.2.3.geo");
|
.indexedShapePath("1.2.3.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
|
|
||||||
// now test the query variant
|
// now test the query variant
|
||||||
|
@ -179,19 +179,19 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.indexedShapeIndex("shapes")
|
.indexedShapeIndex("shapes")
|
||||||
.indexedShapePath(defaultFieldName);
|
.indexedShapePath(defaultFieldName);
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.geo");
|
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.2.geo");
|
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.2.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.2.3.geo");
|
query = queryBuilder().shapeQuery(defaultFieldName, "1").indexedShapeIndex("shapes").indexedShapePath("1.2.3.geo");
|
||||||
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
result = client().prepareSearch(defaultIndexName).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
|
|
||||||
QueryBuilder intersects = queryBuilder().intersectionQuery(defaultFieldName, queryCollection);
|
QueryBuilder intersects = queryBuilder().intersectionQuery(defaultFieldName, queryCollection);
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(intersects).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(intersects).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertTrue("query: " + intersects + " doc: " + Strings.toString(docSource), result.getHits().getTotalHits().value > 0);
|
assertTrue("query: " + intersects + " doc: " + Strings.toString(docSource), result.getHits().getTotalHits().value > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, query))
|
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, query))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("blakely"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("blakely"));
|
||||||
|
@ -395,7 +395,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName)
|
SearchResponse result = client().prepareSearch(defaultIndexName)
|
||||||
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, point))
|
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, point))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
client().prepareIndex(defaultIndexName).setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
client().prepareIndex(defaultIndexName).setId("1").setSource(docSource).setRefreshPolicy(IMMEDIATE).get();
|
||||||
QueryBuilder filter = queryBuilder().shapeQuery(defaultFieldName, innerPolygon).relation(ShapeRelation.CONTAINS);
|
QueryBuilder filter = queryBuilder().shapeQuery(defaultFieldName, innerPolygon).relation(ShapeRelation.CONTAINS);
|
||||||
SearchResponse response = client().prepareSearch(defaultIndexName).setQuery(filter).get();
|
SearchResponse response = client().prepareSearch(defaultIndexName).setQuery(filter).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
|
|
||||||
ExistsQueryBuilder eqb = existsQuery(defaultFieldName);
|
ExistsQueryBuilder eqb = existsQuery(defaultFieldName);
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(eqb).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(eqb).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, "Big_Rectangle"))
|
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, "Big_Rectangle"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -470,7 +470,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, "Big_Rectangle"))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, "Big_Rectangle"))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -492,7 +492,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName)
|
SearchResponse result = client().prepareSearch(defaultIndexName)
|
||||||
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, polygon))
|
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, polygon))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,26 +539,26 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
{
|
{
|
||||||
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon1)));
|
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon1)));
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon2)));
|
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon2)));
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 0);
|
assertHitCount(result, 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon1, polygon2)));
|
QueryBuilder filter = queryBuilder().intersectionQuery(defaultFieldName, new GeometryCollection<>(List.of(polygon1, polygon2)));
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// no shape
|
// no shape
|
||||||
QueryBuilder filter = queryBuilder().shapeQuery(defaultFieldName, GeometryCollection.EMPTY);
|
QueryBuilder filter = queryBuilder().shapeQuery(defaultFieldName, GeometryCollection.EMPTY);
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(defaultIndexName).setQuery(matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 0);
|
assertHitCount(result, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -627,7 +627,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setTrackTotalHits(true)
|
.setTrackTotalHits(true)
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, point).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, point).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setTrackTotalHits(true)
|
.setTrackTotalHits(true)
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, point).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, point).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ public abstract class BaseShapeQueryTestCase<T extends AbstractGeometryQueryBuil
|
||||||
.setTrackTotalHits(true)
|
.setTrackTotalHits(true)
|
||||||
.setQuery(queryBuilder().shapeQuery(defaultFieldName, center).relation(ShapeRelation.INTERSECTS))
|
.setQuery(queryBuilder().shapeQuery(defaultFieldName, center).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo((long) polygons.length));
|
assertThat(searchHits.getTotalHits().value, equalTo((long) polygons.length));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCountAndNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
|
|
||||||
public abstract class GeoShapeQueryTestCase extends BaseShapeQueryTestCase<GeoShapeQueryBuilder> {
|
public abstract class GeoShapeQueryTestCase extends BaseShapeQueryTestCase<GeoShapeQueryBuilder> {
|
||||||
|
@ -160,11 +159,10 @@ public abstract class GeoShapeQueryTestCase extends BaseShapeQueryTestCase<GeoSh
|
||||||
|
|
||||||
Point filterShape = new Point(179, 0);
|
Point filterShape = new Point(179, 0);
|
||||||
|
|
||||||
SearchResponse result = client().prepareSearch(defaultIndexName)
|
assertHitCountAndNoFailures(
|
||||||
.setQuery(queryBuilder().intersectionQuery(defaultFieldName, filterShape))
|
client().prepareSearch(defaultIndexName).setQuery(queryBuilder().intersectionQuery(defaultFieldName, filterShape)),
|
||||||
.get();
|
1
|
||||||
assertSearchResponse(result);
|
);
|
||||||
assertHitCount(result, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Line makeRandomLine() {
|
protected Line makeRandomLine() {
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class ElasticsearchAssertions {
|
||||||
public static void assertSortValues(SearchRequestBuilder searchRequestBuilder, Object[]... sortValues) {
|
public static void assertSortValues(SearchRequestBuilder searchRequestBuilder, Object[]... sortValues) {
|
||||||
var searchResponse = searchRequestBuilder.get();
|
var searchResponse = searchRequestBuilder.get();
|
||||||
try {
|
try {
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHit[] hits = searchResponse.getHits().getHits();
|
SearchHit[] hits = searchResponse.getHits().getHits();
|
||||||
assertEquals(sortValues.length, hits.length);
|
assertEquals(sortValues.length, hits.length);
|
||||||
for (int i = 0; i < sortValues.length; ++i) {
|
for (int i = 0; i < sortValues.length; ++i) {
|
||||||
|
@ -312,6 +312,16 @@ public class ElasticsearchAssertions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void assertHitCountAndNoFailures(SearchRequestBuilder searchRequestBuilder, long expectedHitCount) {
|
||||||
|
var res = searchRequestBuilder.get();
|
||||||
|
try {
|
||||||
|
assertHitCount(res, expectedHitCount);
|
||||||
|
assertNoFailures(res);
|
||||||
|
} finally {
|
||||||
|
res.decRef();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void assertExists(GetResponse response) {
|
public static void assertExists(GetResponse response) {
|
||||||
String message = String.format(Locale.ROOT, "Expected %s/%s to exist, but does not", response.getIndex(), response.getId());
|
String message = String.format(Locale.ROOT, "Expected %s/%s to exist, but does not", response.getIndex(), response.getId());
|
||||||
assertThat(message, response.isExists(), is(true));
|
assertThat(message, response.isExists(), is(true));
|
||||||
|
@ -659,23 +669,6 @@ public class ElasticsearchAssertions {
|
||||||
assertThat(extraInfo, ExceptionsHelper.status(e), equalTo(status));
|
assertThat(extraInfo, ExceptionsHelper.status(e), equalTo(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 serializable.
|
|
||||||
*/
|
|
||||||
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 serializable.
|
|
||||||
*/
|
|
||||||
public static SearchResponse assertSearchResponse(SearchResponse response) {
|
|
||||||
assertNoFailures(response);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a file exists
|
* Check if a file exists
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -41,7 +41,7 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.min;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.range;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.sum;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -104,7 +104,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.setSize(numDocs)
|
.setSize(numDocs)
|
||||||
.addSort("ul_field", SortOrder.ASC)
|
.addSort("ul_field", SortOrder.ASC)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, numDocs);
|
assertEquals(hits.length, numDocs);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -119,7 +119,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.setSize(numDocs)
|
.setSize(numDocs)
|
||||||
.addSort("ul_field", SortOrder.DESC)
|
.addSort("ul_field", SortOrder.DESC)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, numDocs);
|
assertEquals(hits.length, numDocs);
|
||||||
int i = numDocs - 1;
|
int i = numDocs - 1;
|
||||||
|
@ -135,7 +135,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.addSort("ul_field", SortOrder.ASC)
|
.addSort("ul_field", SortOrder.ASC)
|
||||||
.searchAfter(new Long[] { 100L })
|
.searchAfter(new Long[] { 100L })
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, 7);
|
assertEquals(hits.length, 7);
|
||||||
int i = 3;
|
int i = 3;
|
||||||
|
@ -151,7 +151,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.addSort("ul_field", SortOrder.ASC)
|
.addSort("ul_field", SortOrder.ASC)
|
||||||
.searchAfter(new BigInteger[] { new BigInteger("18446744073709551614") })
|
.searchAfter(new BigInteger[] { new BigInteger("18446744073709551614") })
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, 2);
|
assertEquals(hits.length, 2);
|
||||||
int i = 8;
|
int i = 8;
|
||||||
|
@ -167,7 +167,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.addSort("ul_field", SortOrder.ASC)
|
.addSort("ul_field", SortOrder.ASC)
|
||||||
.searchAfter(new String[] { "18446744073709551614" })
|
.searchAfter(new String[] { "18446744073709551614" })
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, 2);
|
assertEquals(hits.length, 2);
|
||||||
int i = 8;
|
int i = 8;
|
||||||
|
@ -203,7 +203,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.addSort("ul_field", SortOrder.DESC)
|
.addSort("ul_field", SortOrder.DESC)
|
||||||
.searchAfter(new BigInteger[] { new BigInteger("18446744073709551615") })
|
.searchAfter(new BigInteger[] { new BigInteger("18446744073709551615") })
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
SearchHit[] hits = response.getHits().getHits();
|
SearchHit[] hits = response.getHits().getHits();
|
||||||
assertEquals(hits.length, 8);
|
assertEquals(hits.length, 8);
|
||||||
int i = 7;
|
int i = 7;
|
||||||
|
@ -218,7 +218,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
// terms agg
|
// terms agg
|
||||||
{
|
{
|
||||||
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(terms("ul_terms").field("ul_field")).get();
|
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(terms("ul_terms").field("ul_field")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Terms terms = response.getAggregations().get("ul_terms");
|
Terms terms = response.getAggregations().get("ul_terms");
|
||||||
|
|
||||||
long[] expectedBucketDocCounts = { 2, 2, 2, 1, 1, 1, 1 };
|
long[] expectedBucketDocCounts = { 2, 2, 2, 1, 1, 1, 1 };
|
||||||
|
@ -244,7 +244,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.addAggregation(histogram("ul_histo").field("ul_field").interval(9E18).minDocCount(0))
|
.addAggregation(histogram("ul_histo").field("ul_field").interval(9E18).minDocCount(0))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Histogram histo = response.getAggregations().get("ul_histo");
|
Histogram histo = response.getAggregations().get("ul_histo");
|
||||||
|
|
||||||
long[] expectedBucketDocCounts = { 3, 3, 4 };
|
long[] expectedBucketDocCounts = { 3, 3, 4 };
|
||||||
|
@ -265,7 +265,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
range("ul_range").field("ul_field").addUnboundedTo(9.0E18).addRange(9.0E18, 1.8E19).addUnboundedFrom(1.8E19)
|
range("ul_range").field("ul_field").addUnboundedTo(9.0E18).addRange(9.0E18, 1.8E19).addUnboundedFrom(1.8E19)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Range range = response.getAggregations().get("ul_range");
|
Range range = response.getAggregations().get("ul_range");
|
||||||
|
|
||||||
long[] expectedBucketDocCounts = { 3, 3, 4 };
|
long[] expectedBucketDocCounts = { 3, 3, 4 };
|
||||||
|
@ -281,7 +281,7 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
// sum agg
|
// sum agg
|
||||||
{
|
{
|
||||||
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(sum("ul_sum").field("ul_field")).get();
|
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(sum("ul_sum").field("ul_field")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Sum sum = response.getAggregations().get("ul_sum");
|
Sum sum = response.getAggregations().get("ul_sum");
|
||||||
double expectedSum = Arrays.stream(values).mapToDouble(Number::doubleValue).sum();
|
double expectedSum = Arrays.stream(values).mapToDouble(Number::doubleValue).sum();
|
||||||
assertEquals(expectedSum, sum.value(), 0.001);
|
assertEquals(expectedSum, sum.value(), 0.001);
|
||||||
|
@ -289,14 +289,14 @@ public class UnsignedLongTests extends ESIntegTestCase {
|
||||||
// max agg
|
// max agg
|
||||||
{
|
{
|
||||||
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(max("ul_max").field("ul_field")).get();
|
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(max("ul_max").field("ul_field")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Max max = response.getAggregations().get("ul_max");
|
Max max = response.getAggregations().get("ul_max");
|
||||||
assertEquals(1.8446744073709551615E19, max.value(), 0.001);
|
assertEquals(1.8446744073709551615E19, max.value(), 0.001);
|
||||||
}
|
}
|
||||||
// min agg
|
// min agg
|
||||||
{
|
{
|
||||||
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(min("ul_min").field("ul_field")).get();
|
SearchResponse response = client().prepareSearch("idx").setSize(0).addAggregation(min("ul_min").field("ul_field")).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
Min min = response.getAggregations().get("ul_min");
|
Min min = response.getAggregations().get("ul_min");
|
||||||
assertEquals(0, min.value(), 0.001);
|
assertEquals(0, min.value(), 0.001);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ import static org.elasticsearch.index.query.QueryBuilders.matchQuery;
|
||||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHistogram;
|
import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHistogram;
|
||||||
import static org.elasticsearch.snapshots.SearchableSnapshotsSettings.SEARCHABLE_SNAPSHOT_STORE_TYPE;
|
import static org.elasticsearch.snapshots.SearchableSnapshotsSettings.SEARCHABLE_SNAPSHOT_STORE_TYPE;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_RECOVERY_STATE_FACTORY_KEY;
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_RECOVERY_STATE_FACTORY_KEY;
|
||||||
import static org.hamcrest.Matchers.arrayWithSize;
|
import static org.hamcrest.Matchers.arrayWithSize;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
@ -470,7 +470,7 @@ public class FrozenSearchableSnapshotsIntegTests extends BaseFrozenSearchableSna
|
||||||
dateHistogram("histo").field("f").timeZone(ZoneId.of("+01:00")).minDocCount(0).calendarInterval(DateHistogramInterval.MONTH)
|
dateHistogram("histo").field("f").timeZone(ZoneId.of("+01:00")).minDocCount(0).calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r1);
|
assertNoFailures(r1);
|
||||||
|
|
||||||
assertRequestCacheState(client(), "test-index", 0, 1);
|
assertRequestCacheState(client(), "test-index", 0, 1);
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ public class FrozenSearchableSnapshotsIntegTests extends BaseFrozenSearchableSna
|
||||||
.calendarInterval(DateHistogramInterval.MONTH)
|
.calendarInterval(DateHistogramInterval.MONTH)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(r2);
|
assertNoFailures(r2);
|
||||||
assertRequestCacheState(client(), "test-index", i + 1, 1);
|
assertRequestCacheState(client(), "test-index", i + 1, 1);
|
||||||
Histogram h1 = r1.getAggregations().get("histo");
|
Histogram h1 = r1.getAggregations().get("histo");
|
||||||
Histogram h2 = r2.getAggregations().get("histo");
|
Histogram h2 = r2.getAggregations().get("histo");
|
||||||
|
|
|
@ -96,7 +96,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitC
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHits;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
|
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
|
||||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||||
|
@ -541,14 +540,14 @@ public class DocumentLevelSecurityTests extends SecurityIntegTestCase {
|
||||||
SearchResponse result = client().filterWithHeader(
|
SearchResponse result = client().filterWithHeader(
|
||||||
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user1", USERS_PASSWD))
|
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user1", USERS_PASSWD))
|
||||||
).prepareSearch("query_index").setQuery(new PercolateQueryBuilder("query", "doc_index", "1", null, null, null)).get();
|
).prepareSearch("query_index").setQuery(new PercolateQueryBuilder("query", "doc_index", "1", null, null, null)).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user2 can access the query_index itself (without performing percolate search)
|
// user2 can access the query_index itself (without performing percolate search)
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD)))
|
||||||
.prepareSearch("query_index")
|
.prepareSearch("query_index")
|
||||||
.setQuery(QueryBuilders.matchAllQuery())
|
.setQuery(QueryBuilders.matchAllQuery())
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user2 cannot access doc#1 of the doc_index so the percolate search fails because doc#1 cannot be found
|
// user2 cannot access doc#1 of the doc_index so the percolate search fails because doc#1 cannot be found
|
||||||
ResourceNotFoundException e = expectThrows(
|
ResourceNotFoundException e = expectThrows(
|
||||||
|
@ -596,14 +595,14 @@ public class DocumentLevelSecurityTests extends SecurityIntegTestCase {
|
||||||
requestBuilder.setQuery(shapeQuery);
|
requestBuilder.setQuery(shapeQuery);
|
||||||
}
|
}
|
||||||
result = requestBuilder.get();
|
result = requestBuilder.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user2 does not have access to doc#1 of the shape_index
|
// user2 does not have access to doc#1 of the shape_index
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD)))
|
||||||
.prepareSearch("search_index")
|
.prepareSearch("search_index")
|
||||||
.setQuery(QueryBuilders.matchAllQuery())
|
.setQuery(QueryBuilders.matchAllQuery())
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
IllegalArgumentException e;
|
IllegalArgumentException e;
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
|
|
|
@ -82,7 +82,6 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchHitsWithoutFailures;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
|
||||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
|
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.BASIC_AUTH_HEADER;
|
||||||
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
import static org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken.basicAuthHeaderValue;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -485,33 +484,33 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
|
||||||
SearchResponse result = client().filterWithHeader(
|
SearchResponse result = client().filterWithHeader(
|
||||||
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user7", USERS_PASSWD))
|
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user7", USERS_PASSWD))
|
||||||
).prepareSearch("query_index").setQuery(percolateQuery).get();
|
).prepareSearch("query_index").setQuery(percolateQuery).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD)))
|
||||||
.prepareSearch("query_index")
|
.prepareSearch("query_index")
|
||||||
.setQuery(QueryBuilders.matchAllQuery())
|
.setQuery(QueryBuilders.matchAllQuery())
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user 3 can see the fields of the percolated document, but not the "query" field of the indexed query
|
// user 3 can see the fields of the percolated document, but not the "query" field of the indexed query
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD)))
|
||||||
.prepareSearch("query_index")
|
.prepareSearch("query_index")
|
||||||
.setQuery(percolateQuery)
|
.setQuery(percolateQuery)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 0);
|
assertHitCount(result, 0);
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user9", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user9", USERS_PASSWD)))
|
||||||
.prepareSearch("query_index")
|
.prepareSearch("query_index")
|
||||||
.setQuery(QueryBuilders.matchAllQuery())
|
.setQuery(QueryBuilders.matchAllQuery())
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user 9 can see the fields of the index query, but not the field of the indexed document to be percolated
|
// user 9 can see the fields of the index query, but not the field of the indexed document to be percolated
|
||||||
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user9", USERS_PASSWD)))
|
result = client().filterWithHeader(Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user9", USERS_PASSWD)))
|
||||||
.prepareSearch("query_index")
|
.prepareSearch("query_index")
|
||||||
.setQuery(percolateQuery)
|
.setQuery(percolateQuery)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 0);
|
assertHitCount(result, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +572,7 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
|
||||||
requestBuilder.setQuery(shapeQuery1);
|
requestBuilder.setQuery(shapeQuery1);
|
||||||
}
|
}
|
||||||
result = requestBuilder.get();
|
result = requestBuilder.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
// user sees the queried point but not the querying shape
|
// user sees the queried point but not the querying shape
|
||||||
final ShapeQueryBuilder shapeQuery2 = new ShapeQueryBuilder("field", "2").relation(ShapeRelation.WITHIN)
|
final ShapeQueryBuilder shapeQuery2 = new ShapeQueryBuilder("field", "2").relation(ShapeRelation.WITHIN)
|
||||||
|
@ -611,7 +610,7 @@ public class FieldLevelSecurityTests extends SecurityIntegTestCase {
|
||||||
requestBuilder.setQuery(shapeQuery3);
|
requestBuilder.setQuery(shapeQuery3);
|
||||||
}
|
}
|
||||||
result = requestBuilder.get();
|
result = requestBuilder.get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 0);
|
assertHitCount(result, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||||
|
@ -268,7 +268,7 @@ public class GeoShapeScriptDocValuesIT extends ESSingleNodeTestCase {
|
||||||
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
.addScriptField("label_lat", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lat", Collections.emptyMap()))
|
||||||
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
.addScriptField("label_lon", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "label_lon", Collections.emptyMap()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
||||||
assertThat(fields.get("lat").getValue(), equalTo(value.getY()));
|
assertThat(fields.get("lat").getValue(), equalTo(value.getY()));
|
||||||
assertThat(fields.get("lon").getValue(), equalTo(value.getX()));
|
assertThat(fields.get("lon").getValue(), equalTo(value.getX()));
|
||||||
|
@ -323,7 +323,7 @@ public class GeoShapeScriptDocValuesIT extends ESSingleNodeTestCase {
|
||||||
.addScriptField("height", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "height", Collections.emptyMap()))
|
.addScriptField("height", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "height", Collections.emptyMap()))
|
||||||
.addScriptField("width", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "width", Collections.emptyMap()))
|
.addScriptField("width", new Script(ScriptType.INLINE, CustomScriptPlugin.NAME, "width", Collections.emptyMap()))
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
Map<String, DocumentField> fields = searchResponse.getHits().getHits()[0].getFields();
|
||||||
assertThat(fields.get("lat").getValue(), equalTo(Double.NaN));
|
assertThat(fields.get("lat").getValue(), equalTo(Double.NaN));
|
||||||
assertThat(fields.get("lon").getValue(), equalTo(Double.NaN));
|
assertThat(fields.get("lon").getValue(), equalTo(Double.NaN));
|
||||||
|
|
|
@ -35,7 +35,7 @@ import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDI
|
||||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
|
@ -176,43 +176,43 @@ public class ShapeQueryOverShapeTests extends ShapeQueryTestCase {
|
||||||
.indexedShapeIndex(indexName)
|
.indexedShapeIndex(indexName)
|
||||||
.indexedShapePath("location");
|
.indexedShapePath("location");
|
||||||
SearchResponse result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
SearchResponse result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex(indexName)
|
.indexedShapeIndex(indexName)
|
||||||
.indexedShapePath("1.location");
|
.indexedShapePath("1.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex(indexName)
|
.indexedShapeIndex(indexName)
|
||||||
.indexedShapePath("1.2.location");
|
.indexedShapePath("1.2.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
filter = new ShapeQueryBuilder("location", "1").relation(ShapeRelation.INTERSECTS)
|
||||||
.indexedShapeIndex(indexName)
|
.indexedShapeIndex(indexName)
|
||||||
.indexedShapePath("1.2.3.location");
|
.indexedShapePath("1.2.3.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
result = client().prepareSearch(searchIndex).setQuery(QueryBuilders.matchAllQuery()).setPostFilter(filter).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
|
|
||||||
// now test the query variant
|
// now test the query variant
|
||||||
ShapeQueryBuilder query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("location");
|
ShapeQueryBuilder query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.location");
|
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.2.location");
|
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.2.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.2.3.location");
|
query = new ShapeQueryBuilder("location", "1").indexedShapeIndex(indexName).indexedShapePath("1.2.3.location");
|
||||||
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
result = client().prepareSearch(searchIndex).setQuery(query).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, 1);
|
assertHitCount(result, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ public class ShapeQueryOverShapeTests extends ShapeQueryTestCase {
|
||||||
public void testExistsQuery() {
|
public void testExistsQuery() {
|
||||||
ExistsQueryBuilder eqb = QueryBuilders.existsQuery(FIELD);
|
ExistsQueryBuilder eqb = QueryBuilders.existsQuery(FIELD);
|
||||||
SearchResponse result = client().prepareSearch(INDEX).setQuery(eqb).get();
|
SearchResponse result = client().prepareSearch(INDEX).setQuery(eqb).get();
|
||||||
assertSearchResponse(result);
|
assertNoFailures(result);
|
||||||
assertHitCount(result, numDocs);
|
assertHitCount(result, numDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ public class ShapeQueryOverShapeTests extends ShapeQueryTestCase {
|
||||||
Rectangle rectangle = new Rectangle(-50, 50, 50, -50);
|
Rectangle rectangle = new Rectangle(-50, 50, 50, -50);
|
||||||
ShapeQueryBuilder queryBuilder = new ShapeQueryBuilder("location", rectangle).relation(ShapeRelation.CONTAINS);
|
ShapeQueryBuilder queryBuilder = new ShapeQueryBuilder("location", rectangle).relation(ShapeRelation.CONTAINS);
|
||||||
SearchResponse response = client().prepareSearch("test_contains").setQuery(queryBuilder).get();
|
SearchResponse response = client().prepareSearch("test_contains").setQuery(queryBuilder).get();
|
||||||
assertSearchResponse(response);
|
assertNoFailures(response);
|
||||||
|
|
||||||
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(response.getHits().getTotalHits().value, equalTo(1L));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE;
|
||||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||||
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
|
@ -87,7 +87,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
.setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -95,7 +95,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
// default query, without specifying relation (expect intersects)
|
// default query, without specifying relation (expect intersects)
|
||||||
searchResponse = client().prepareSearch(defaultIndexName).setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle)).get();
|
searchResponse = client().prepareSearch(defaultIndexName).setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle)).get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -124,7 +124,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.setQuery(new ShapeQueryBuilder(defaultFieldName, circle).relation(ShapeRelation.INTERSECTS))
|
.setQuery(new ShapeQueryBuilder(defaultFieldName, circle).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -153,7 +153,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.setQuery(new ShapeQueryBuilder(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
.setQuery(new ShapeQueryBuilder(defaultFieldName, polygon).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
SearchHits searchHits = searchResponse.getHits();
|
SearchHits searchHits = searchResponse.getHits();
|
||||||
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
assertThat(searchHits.getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchHits.getAt(0).getId(), equalTo("1"));
|
assertThat(searchHits.getAt(0).getId(), equalTo("1"));
|
||||||
|
@ -195,7 +195,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.setQuery(new ShapeQueryBuilder(defaultFieldName, mp).relation(ShapeRelation.INTERSECTS))
|
.setQuery(new ShapeQueryBuilder(defaultFieldName, mp).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(2L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(2));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
assertThat(searchResponse.getHits().getAt(0).getId(), not(equalTo("2")));
|
||||||
|
@ -225,7 +225,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
.setQuery(new ShapeQueryBuilder(defaultFieldName, rectangle).relation(ShapeRelation.INTERSECTS))
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("2"));
|
||||||
|
@ -283,7 +283,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(1L));
|
||||||
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
assertThat(searchResponse.getHits().getHits().length, equalTo(1));
|
||||||
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("point2"));
|
assertThat(searchResponse.getHits().getAt(0).getId(), equalTo("point2"));
|
||||||
|
@ -295,7 +295,7 @@ public abstract class ShapeQueryTestCase extends ESSingleNodeTestCase {
|
||||||
.indexedShapePath(indexedShapePath)
|
.indexedShapePath(indexedShapePath)
|
||||||
)
|
)
|
||||||
.get();
|
.get();
|
||||||
assertSearchResponse(searchResponse);
|
assertNoFailures(searchResponse);
|
||||||
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
assertThat(searchResponse.getHits().getTotalHits().value, equalTo(0L));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue