Change Terms.Bucket to an interface (#24492)

This commit changes the Terms.Bucket abstract class to an interface, so
that it's easier for the Java High Level Rest Client to provide its own
implementation.

In its current state, the Terms.Bucket abstract class inherits from
InternalMultiBucketAggregation.InternalBucket which forces subclasses to
implement Writeable and exposes a public getProperty() method that relies
on InternalAggregation. This two points make it difficult for the Java
High Level Rest Client to implement the Terms and Terms.Bucket correctly.
This is also different from other MultiBucketsAggregation like Range
which are pure interfaces.

Changing Terms.Bucket to an interface causes a method clashes for the
`getBuckets()` method in InternalTerms. This is because:
 - InternalTerms implements Terms which declared a
 `List<Terms.Bucket> getBuckets()` method
 - InternalTerms extends InternalMultiBucketAggregation which declares a
 `List<? extends InternalBucket> getBuckets()` method
 - both overrides the MultiBucketsAggregation
 `List<? extends Bucket> getBuckets()` method

 There was no clashes before this change because Terms.Bucket extends
 InternalBucket and conformed to both declaration. With Terms.Bucket now
 an interface, the getBuckets() method in the Terms interface is changed
 to avoid method clash. This is a breaking change in the Java API but
 it's a straightforward change and the Terms multi bucket aggregation
 interface is also more coherent with the other Range, Histogram,
 Filters, AdjacencyMatrix etc that all return a `List<? extends Bucket>`.
This commit is contained in:
Tanguy Leroux 2017-05-05 20:00:39 +02:00 committed by GitHub
parent 0b36fb052c
commit 7bd2abe48a
39 changed files with 125 additions and 156 deletions

View File

@ -76,7 +76,7 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
} }
@Override @Override
int compareTerm(Terms.Bucket other) { public int compareTerm(Terms.Bucket other) {
return Double.compare(term, ((Number) other.getKey()).doubleValue()); return Double.compare(term, ((Number) other.getKey()).doubleValue());
} }

View File

@ -218,7 +218,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
} }
@Override @Override
int compareTerm(Terms.Bucket other) { public int compareTerm(Terms.Bucket other) {
return Long.compare(globalOrd, ((OrdBucket) other).globalOrd); return Long.compare(globalOrd, ((OrdBucket) other).globalOrd);
} }

View File

@ -26,6 +26,7 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -101,7 +102,7 @@ public abstract class InternalMappedTerms<A extends InternalTerms<A, B>, B exten
} }
@Override @Override
public List<B> getBucketsInternal() { public List<B> getBuckets() {
return buckets; return buckets;
} }

View File

@ -40,15 +40,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import static java.util.Collections.unmodifiableList;
public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends InternalTerms.Bucket<B>> public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends InternalTerms.Bucket<B>>
extends InternalMultiBucketAggregation<A, B> implements Terms, ToXContent { extends InternalMultiBucketAggregation<A, B> implements Terms, ToXContent {
protected static final ParseField DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME = new ParseField("doc_count_error_upper_bound"); protected static final ParseField DOC_COUNT_ERROR_UPPER_BOUND_FIELD_NAME = new ParseField("doc_count_error_upper_bound");
protected static final ParseField SUM_OF_OTHER_DOC_COUNTS = new ParseField("sum_other_doc_count"); protected static final ParseField SUM_OF_OTHER_DOC_COUNTS = new ParseField("sum_other_doc_count");
public abstract static class Bucket<B extends Bucket<B>> extends Terms.Bucket { public abstract static class Bucket<B extends Bucket<B>> extends InternalMultiBucketAggregation.InternalBucket implements Terms.Bucket {
/** /**
* Reads a bucket. Should be a constructor reference. * Reads a bucket. Should be a constructor reference.
@ -212,11 +210,7 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
protected abstract void writeTermTypeInfoTo(StreamOutput out) throws IOException; protected abstract void writeTermTypeInfoTo(StreamOutput out) throws IOException;
@Override @Override
public final List<Terms.Bucket> getBuckets() { public abstract List<B> getBuckets();
return unmodifiableList(getBucketsInternal());
}
protected abstract List<B> getBucketsInternal();
@Override @Override
public abstract B getBucketByKey(String term); public abstract B getBucketByKey(String term);
@ -244,7 +238,7 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
} }
otherDocCount += terms.getSumOfOtherDocCounts(); otherDocCount += terms.getSumOfOtherDocCounts();
final long thisAggDocCountError; final long thisAggDocCountError;
if (terms.getBucketsInternal().size() < getShardSize() || InternalOrder.isTermOrder(order)) { if (terms.getBuckets().size() < getShardSize() || InternalOrder.isTermOrder(order)) {
thisAggDocCountError = 0; thisAggDocCountError = 0;
} else if (InternalOrder.isCountDesc(this.order)) { } else if (InternalOrder.isCountDesc(this.order)) {
if (terms.getDocCountError() > 0) { if (terms.getDocCountError() > 0) {
@ -254,7 +248,7 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
} else { } else {
// otherwise use the doc count of the last term in the // otherwise use the doc count of the last term in the
// aggregation // aggregation
thisAggDocCountError = terms.getBucketsInternal().get(terms.getBucketsInternal().size() - 1).docCount; thisAggDocCountError = terms.getBuckets().get(terms.getBuckets().size() - 1).docCount;
} }
} else { } else {
thisAggDocCountError = -1; thisAggDocCountError = -1;
@ -267,7 +261,7 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
} }
} }
setDocCountError(thisAggDocCountError); setDocCountError(thisAggDocCountError);
for (B bucket : terms.getBucketsInternal()) { for (B bucket : terms.getBuckets()) {
// If there is already a doc count error for this bucket // If there is already a doc count error for this bucket
// subtract this aggs doc count error from it to make the // subtract this aggs doc count error from it to make the
// new value for the bucket. This then means that when the // new value for the bucket. This then means that when the

View File

@ -76,7 +76,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
} }
@Override @Override
int compareTerm(Terms.Bucket other) { public int compareTerm(Terms.Bucket other) {
return Long.compare(term, ((Number) other.getKey()).longValue()); return Long.compare(term, ((Number) other.getKey()).longValue());
} }
@ -161,7 +161,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
* Converts a {@link LongTerms} into a {@link DoubleTerms}, returning the value of the specified long terms as doubles. * Converts a {@link LongTerms} into a {@link DoubleTerms}, returning the value of the specified long terms as doubles.
*/ */
static DoubleTerms convertLongTermsToDouble(LongTerms longTerms, DocValueFormat decimalFormat) { static DoubleTerms convertLongTermsToDouble(LongTerms longTerms, DocValueFormat decimalFormat) {
List<Terms.Bucket> buckets = longTerms.getBuckets(); List<LongTerms.Bucket> buckets = longTerms.getBuckets();
List<DoubleTerms.Bucket> newBuckets = new ArrayList<>(); List<DoubleTerms.Bucket> newBuckets = new ArrayList<>();
for (Terms.Bucket bucket : buckets) { for (Terms.Bucket bucket : buckets) {
newBuckets.add(new DoubleTerms.Bucket(bucket.getKeyAsNumber().doubleValue(), newBuckets.add(new DoubleTerms.Bucket(bucket.getKeyAsNumber().doubleValue(),

View File

@ -75,7 +75,7 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
} }
@Override @Override
int compareTerm(Terms.Bucket other) { public int compareTerm(Terms.Bucket other) {
return termBytes.compareTo(((Bucket) other).termBytes); return termBytes.compareTo(((Bucket) other).termBytes);
} }

View File

@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.terms;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import java.util.Arrays; import java.util.Arrays;
@ -33,50 +32,23 @@ import java.util.List;
*/ */
public interface Terms extends MultiBucketsAggregation { public interface Terms extends MultiBucketsAggregation {
enum ValueType {
STRING(org.elasticsearch.search.aggregations.support.ValueType.STRING),
LONG(org.elasticsearch.search.aggregations.support.ValueType.LONG),
DOUBLE(org.elasticsearch.search.aggregations.support.ValueType.DOUBLE);
final org.elasticsearch.search.aggregations.support.ValueType scriptValueType;
ValueType(org.elasticsearch.search.aggregations.support.ValueType scriptValueType) {
this.scriptValueType = scriptValueType;
}
static ValueType resolveType(String type) {
if ("string".equals(type)) {
return STRING;
}
if ("double".equals(type) || "float".equals(type)) {
return DOUBLE;
}
if ("long".equals(type) || "integer".equals(type) || "short".equals(type) || "byte".equals(type)) {
return LONG;
}
return null;
}
}
/** /**
* A bucket that is associated with a single term * A bucket that is associated with a single term
*/ */
abstract class Bucket extends InternalMultiBucketAggregation.InternalBucket { interface Bucket extends MultiBucketsAggregation.Bucket {
public abstract Number getKeyAsNumber(); Number getKeyAsNumber();
abstract int compareTerm(Terms.Bucket other); int compareTerm(Terms.Bucket other);
public abstract long getDocCountError();
long getDocCountError();
} }
/** /**
* Return the sorted list of the buckets in this terms aggregation. * Return the sorted list of the buckets in this terms aggregation.
*/ */
@Override @Override
List<Bucket> getBuckets(); List<? extends Bucket> getBuckets();
/** /**
* Get the bucket for the given term, or null if there is no such bucket. * Get the bucket for the given term, or null if there is no such bucket.

View File

@ -127,7 +127,7 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
} }
@Override @Override
protected List<Bucket> getBucketsInternal() { public List<Bucket> getBuckets() {
return emptyList(); return emptyList();
} }

View File

@ -30,7 +30,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import java.util.Collection; import java.util.List;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram;
@ -95,7 +95,7 @@ public class CombiIT extends ESIntegTestCase {
Terms terms = aggs.get("values"); Terms terms = aggs.get("values");
assertNotNull(terms); assertNotNull(terms);
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(values.size())); assertThat(buckets.size(), equalTo(values.size()));
for (Terms.Bucket bucket : buckets) { for (Terms.Bucket bucket : buckets) {
values.remove(((Number) bucket.getKey()).intValue()); values.remove(((Number) bucket.getKey()).intValue());

View File

@ -485,10 +485,10 @@ public class EquivalenceIT extends ESIntegTestCase {
} }
private void assertEquals(Terms t1, Terms t2) { private void assertEquals(Terms t1, Terms t2) {
List<Terms.Bucket> t1Buckets = t1.getBuckets(); List<? extends Terms.Bucket> t1Buckets = t1.getBuckets();
List<Terms.Bucket> t2Buckets = t1.getBuckets(); List<? extends Terms.Bucket> t2Buckets = t1.getBuckets();
assertEquals(t1Buckets.size(), t2Buckets.size()); assertEquals(t1Buckets.size(), t2Buckets.size());
for (Iterator<Terms.Bucket> it1 = t1Buckets.iterator(), it2 = t2Buckets.iterator(); it1.hasNext(); ) { for (Iterator<? extends Terms.Bucket> it1 = t1Buckets.iterator(), it2 = t2Buckets.iterator(); it1.hasNext(); ) {
final Terms.Bucket b1 = it1.next(); final Terms.Bucket b1 = it1.next();
final Terms.Bucket b2 = it2.next(); final Terms.Bucket b2 = it2.next();
assertEquals(b1.getDocCount(), b2.getDocCount()); assertEquals(b1.getDocCount(), b2.getDocCount());

View File

@ -32,6 +32,7 @@ import org.elasticsearch.search.aggregations.metrics.max.Max;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
@ -108,7 +109,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
).execute().actionGet(); ).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
Terms genres = response.getAggregations().get("genres"); Terms genres = response.getAggregations().get("genres");
Collection<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
assertThat(genreBuckets.size(), greaterThan(1)); assertThat(genreBuckets.size(), greaterThan(1));
double lastMaxPrice = asc ? Double.MIN_VALUE : Double.MAX_VALUE; double lastMaxPrice = asc ? Double.MIN_VALUE : Double.MAX_VALUE;
@ -141,7 +142,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
assertSearchResponse(response); assertSearchResponse(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");
Collection<Bucket> testBuckets = authors.getBuckets(); List<? extends Bucket> testBuckets = authors.getBuckets();
for (Terms.Bucket testBucket : testBuckets) { for (Terms.Bucket testBucket : testBuckets) {
assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_AUTHOR)); assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_AUTHOR));
@ -162,11 +163,11 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
.addAggregation(rootTerms).execute().actionGet(); .addAggregation(rootTerms).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
Terms genres = response.getAggregations().get("genres"); Terms genres = response.getAggregations().get("genres");
Collection<Bucket> genreBuckets = genres.getBuckets(); List<? extends Bucket> genreBuckets = genres.getBuckets();
for (Terms.Bucket genreBucket : genreBuckets) { for (Terms.Bucket genreBucket : genreBuckets) {
Sampler sample = genreBucket.getAggregations().get("sample"); Sampler sample = genreBucket.getAggregations().get("sample");
Terms authors = sample.getAggregations().get("authors"); Terms authors = sample.getAggregations().get("authors");
Collection<Bucket> testBuckets = authors.getBuckets(); List<? extends Bucket> testBuckets = authors.getBuckets();
for (Terms.Bucket testBucket : testBuckets) { for (Terms.Bucket testBucket : testBuckets) {
assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_AUTHOR)); assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_AUTHOR));
@ -195,7 +196,7 @@ public class DiversifiedSamplerIT extends ESIntegTestCase {
Sampler sample = genreSample.getAggregations().get("sample"); Sampler sample = genreSample.getAggregations().get("sample");
Terms genres = sample.getAggregations().get("genres"); Terms genres = sample.getAggregations().get("genres");
Collection<Bucket> testBuckets = genres.getBuckets(); List<? extends Bucket> testBuckets = genres.getBuckets();
for (Terms.Bucket testBucket : testBuckets) { for (Terms.Bucket testBucket : testBuckets) {
assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_GENRE)); assertThat(testBucket.getDocCount(), lessThanOrEqualTo((long) NUM_SHARDS * MAX_DOCS_PER_GENRE));
} }

View File

@ -842,7 +842,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("num_tags")); assertThat(tags.getName(), equalTo("num_tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
Terms.Bucket tag = iters.next(); Terms.Bucket tag = iters.next();
assertThat(tag, notNullValue()); assertThat(tag, notNullValue());
@ -883,7 +883,7 @@ public class DoubleTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
// the max for "1" is 2 // the max for "1" is 2
// the max for "0" is 4 // the max for "0" is 4

View File

@ -854,7 +854,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("num_tags")); assertThat(tags.getName(), equalTo("num_tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
Terms.Bucket tag = iters.next(); Terms.Bucket tag = iters.next();
assertThat(tag, notNullValue()); assertThat(tag, notNullValue());
@ -893,7 +893,7 @@ public class LongTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
// the max for "1" is 2 // the max for "1" is 2
// the max for "0" is 4 // the max for "0" is 4

View File

@ -161,8 +161,8 @@ public class MinDocCountIT extends AbstractTermsTestCase {
// check that terms2 is a subset of terms1 // check that terms2 is a subset of terms1
private void assertSubset(Terms terms1, Terms terms2, long minDocCount, int size, String include) { private void assertSubset(Terms terms1, Terms terms2, long minDocCount, int size, String include) {
final Matcher matcher = include == null ? null : Pattern.compile(include).matcher("");; final Matcher matcher = include == null ? null : Pattern.compile(include).matcher("");;
final Iterator<Terms.Bucket> it1 = terms1.getBuckets().iterator(); final Iterator<? extends Terms.Bucket> it1 = terms1.getBuckets().iterator();
final Iterator<Terms.Bucket> it2 = terms2.getBuckets().iterator(); final Iterator<? extends Terms.Bucket> it2 = terms2.getBuckets().iterator();
int size2 = 0; int size2 = 0;
while (it1.hasNext()) { while (it1.hasNext()) {
final Terms.Bucket bucket1 = it1.next(); final Terms.Bucket bucket1 = it1.next();

View File

@ -31,6 +31,7 @@ import org.elasticsearch.search.aggregations.metrics.max.Max;
import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
@ -104,7 +105,7 @@ public class SamplerIT extends ESIntegTestCase {
).execute().actionGet(); ).execute().actionGet();
assertSearchResponse(response); assertSearchResponse(response);
Terms genres = response.getAggregations().get("genres"); Terms genres = response.getAggregations().get("genres");
Collection<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
assertThat(genreBuckets.size(), greaterThan(1)); assertThat(genreBuckets.size(), greaterThan(1));
double lastMaxPrice = asc ? Double.MIN_VALUE : Double.MAX_VALUE; double lastMaxPrice = asc ? Double.MIN_VALUE : Double.MAX_VALUE;
@ -130,7 +131,7 @@ public class SamplerIT extends ESIntegTestCase {
assertSearchResponse(response); assertSearchResponse(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");
Collection<Bucket> testBuckets = authors.getBuckets(); List<? extends Bucket> testBuckets = authors.getBuckets();
long maxBooksPerAuthor = 0; long maxBooksPerAuthor = 0;
for (Terms.Bucket testBucket : testBuckets) { for (Terms.Bucket testBucket : testBuckets) {

View File

@ -22,8 +22,8 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode; import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
@ -43,7 +43,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<String, Long> expected = new HashMap<>(); Map<String, Long> expected = new HashMap<>();
expected.put("1", 8L); expected.put("1", 8L);
@ -66,7 +66,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<String, Long> expected = new HashMap<>(); Map<String, Long> expected = new HashMap<>();
expected.put("1", 8L); expected.put("1", 8L);
@ -90,7 +90,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param) assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
Map<String, Long> expected = new HashMap<>(); Map<String, Long> expected = new HashMap<>();
expected.put("1", 8L); expected.put("1", 8L);
@ -114,7 +114,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param) assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
Map<String, Long> expected = new HashMap<>(); Map<String, Long> expected = new HashMap<>();
expected.put("1", 5L); expected.put("1", 5L);
@ -137,7 +137,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<String, Long> expected = new HashMap<>(); Map<String, Long> expected = new HashMap<>();
expected.put("1", 8L); expected.put("1", 8L);
@ -160,7 +160,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -183,7 +183,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -206,7 +206,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param) assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -230,7 +230,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param) assertThat(buckets.size(), equalTo(3)); // we still only return 3 entries (based on the 'size' param)
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 5L); expected.put(1, 5L);
@ -253,7 +253,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -276,7 +276,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -299,7 +299,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -322,7 +322,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);
@ -345,7 +345,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 5L); expected.put(1, 5L);
@ -368,7 +368,7 @@ public class ShardSizeTermsIT extends ShardSizeTestCase {
.execute().actionGet(); .execute().actionGet();
Terms terms = response.getAggregations().get("keys"); Terms terms = response.getAggregations().get("keys");
Collection<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(3)); assertThat(buckets.size(), equalTo(3));
Map<Integer, Long> expected = new HashMap<>(); Map<Integer, Long> expected = new HashMap<>();
expected.put(1, 8L); expected.put(1, 8L);

View File

@ -438,7 +438,7 @@ public class SignificantTermsSignificanceScoreIT extends ESIntegTestCase {
assertSearchResponse(response); assertSearchResponse(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<Terms.Bucket> classBuckets = classes.getBuckets().iterator(); Iterator<? extends Terms.Bucket> classBuckets = classes.getBuckets().iterator();
Aggregations aggregations = classBuckets.next().getAggregations(); Aggregations aggregations = classBuckets.next().getAggregations();
SignificantTerms sigTerms = aggregations.get("mySignificantTerms"); SignificantTerms sigTerms = aggregations.get("mySignificantTerms");

View File

@ -1012,7 +1012,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
Terms.Bucket tag = iters.next(); Terms.Bucket tag = iters.next();
assertThat(tag, notNullValue()); assertThat(tag, notNullValue());
@ -1054,7 +1054,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
// the max for "more" is 2 // the max for "more" is 2
// the max for "less" is 4 // the max for "less" is 4
@ -1117,7 +1117,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
// the max for "more" is 2 // the max for "more" is 2
// the max for "less" is 4 // the max for "less" is 4
@ -1180,7 +1180,7 @@ public class StringTermsIT extends AbstractTermsTestCase {
assertThat(tags.getName(), equalTo("tags")); assertThat(tags.getName(), equalTo("tags"));
assertThat(tags.getBuckets().size(), equalTo(2)); assertThat(tags.getBuckets().size(), equalTo(2));
Iterator<Terms.Bucket> iters = tags.getBuckets().iterator(); Iterator<? extends Terms.Bucket> iters = tags.getBuckets().iterator();
// the max for "more" is 2 // the max for "more" is 2
// the max for "less" is 4 // the max for "less" is 4

View File

@ -177,7 +177,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
assertThat(testTerms, notNullValue()); assertThat(testTerms, notNullValue());
assertThat(testTerms.getName(), equalTo("terms")); assertThat(testTerms.getName(), equalTo("terms"));
assertThat(testTerms.getDocCountError(), greaterThanOrEqualTo(0L)); assertThat(testTerms.getDocCountError(), greaterThanOrEqualTo(0L));
Collection<Bucket> testBuckets = testTerms.getBuckets(); List<? extends Bucket> testBuckets = testTerms.getBuckets();
assertThat(testBuckets.size(), lessThanOrEqualTo(size)); assertThat(testBuckets.size(), lessThanOrEqualTo(size));
assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size())); assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size()));
@ -211,7 +211,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
assertThat(testTerms, notNullValue()); assertThat(testTerms, notNullValue());
assertThat(testTerms.getName(), equalTo("terms")); assertThat(testTerms.getName(), equalTo("terms"));
assertThat(testTerms.getDocCountError(), equalTo(0L)); assertThat(testTerms.getDocCountError(), equalTo(0L));
Collection<Bucket> testBuckets = testTerms.getBuckets(); List<? extends Bucket> testBuckets = testTerms.getBuckets();
assertThat(testBuckets.size(), lessThanOrEqualTo(size)); assertThat(testBuckets.size(), lessThanOrEqualTo(size));
assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size())); assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size()));
@ -229,7 +229,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
assertThat(testTerms, notNullValue()); assertThat(testTerms, notNullValue());
assertThat(testTerms.getName(), equalTo("terms")); assertThat(testTerms.getName(), equalTo("terms"));
assertThat(testTerms.getDocCountError(), equalTo(0L)); assertThat(testTerms.getDocCountError(), equalTo(0L));
Collection<Bucket> testBuckets = testTerms.getBuckets(); List<? extends Bucket> testBuckets = testTerms.getBuckets();
assertThat(testBuckets.size(), lessThanOrEqualTo(size)); assertThat(testBuckets.size(), lessThanOrEqualTo(size));
for (Terms.Bucket testBucket : testBuckets) { for (Terms.Bucket testBucket : testBuckets) {
@ -248,7 +248,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
assertThat(testTerms, notNullValue()); assertThat(testTerms, notNullValue());
assertThat(testTerms.getName(), equalTo("terms")); assertThat(testTerms.getName(), equalTo("terms"));
assertThat(testTerms.getDocCountError(),anyOf(equalTo(-1L), equalTo(0L))); assertThat(testTerms.getDocCountError(),anyOf(equalTo(-1L), equalTo(0L)));
Collection<Bucket> testBuckets = testTerms.getBuckets(); List<? extends Bucket> testBuckets = testTerms.getBuckets();
assertThat(testBuckets.size(), lessThanOrEqualTo(size)); assertThat(testBuckets.size(), lessThanOrEqualTo(size));
assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size())); assertThat(accurateTerms.getBuckets().size(), greaterThanOrEqualTo(testBuckets.size()));
@ -988,7 +988,7 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getDocCountError(), equalTo(46L)); assertThat(terms.getDocCountError(), equalTo(46L));
List<Bucket> buckets = terms.getBuckets(); List<? extends Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(5)); assertThat(buckets.size(), equalTo(5));

View File

@ -136,7 +136,7 @@ public class TermsAggregatorTests extends AggregatorTestCase {
InternalAggregation mergedAggs = internalAgg.doReduce(aggs, ctx); InternalAggregation mergedAggs = internalAgg.doReduce(aggs, ctx);
assertTrue(mergedAggs instanceof DoubleTerms); assertTrue(mergedAggs instanceof DoubleTerms);
long expected = numLongs + numDoubles; long expected = numLongs + numDoubles;
List<Terms.Bucket> buckets = ((DoubleTerms) mergedAggs).getBuckets(); List<? extends Terms.Bucket> buckets = ((DoubleTerms) mergedAggs).getBuckets();
assertEquals(4, buckets.size()); assertEquals(4, buckets.size());
assertEquals("1.0", buckets.get(0).getKeyAsString()); assertEquals("1.0", buckets.get(0).getKeyAsString());
assertEquals(expected, buckets.get(0).getDocCount()); assertEquals(expected, buckets.get(0).getDocCount());

View File

@ -334,7 +334,7 @@ public class AvgIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -604,7 +604,7 @@ public class ExtendedStatsIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -233,7 +233,7 @@ public class GeoBoundsIT extends AbstractGeoTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Bucket> buckets = terms.getBuckets(); List<? extends Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
Bucket bucket = buckets.get(i); Bucket bucket = buckets.get(i);

View File

@ -515,7 +515,7 @@ public class HDRPercentileRanksIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -506,7 +506,7 @@ public class HDRPercentilesIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -336,7 +336,7 @@ public class MaxIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -348,7 +348,7 @@ public class MinIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -455,7 +455,7 @@ public class StatsIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -333,7 +333,7 @@ public class SumIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -466,7 +466,7 @@ public class TDigestPercentileRanksIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -451,7 +451,7 @@ public class TDigestPercentilesIT extends AbstractNumericTestCase {
Terms terms = searchResponse.getAggregations().get("terms"); Terms terms = searchResponse.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets, notNullValue()); assertThat(buckets, notNullValue());
assertThat(buckets.size(), equalTo(10)); assertThat(buckets.size(), equalTo(10));

View File

@ -519,9 +519,9 @@ public class TopHitsIT extends ESIntegTestCase {
SearchHits hits = topHits.getHits(); SearchHits hits = topHits.getHits();
assertThat(hits.getTotalHits(), equalTo(10L)); assertThat(hits.getTotalHits(), equalTo(10L));
assertThat(hits.getHits().length, equalTo(3)); assertThat(hits.getHits().length, equalTo(3));
assertThat((Long) hits.getAt(0).getSortValues()[0], equalTo(higestSortValue)); assertThat(hits.getAt(0).getSortValues()[0], equalTo(higestSortValue));
assertThat((Long) hits.getAt(1).getSortValues()[0], equalTo(higestSortValue - 1)); assertThat(hits.getAt(1).getSortValues()[0], equalTo(higestSortValue - 1));
assertThat((Long) hits.getAt(2).getSortValues()[0], equalTo(higestSortValue - 2)); assertThat(hits.getAt(2).getSortValues()[0], equalTo(higestSortValue - 2));
Max max = bucket.getAggregations().get("max_sort"); Max max = bucket.getAggregations().get("max_sort");
assertThat(max.getValue(), equalTo(((Long) higestSortValue).doubleValue())); assertThat(max.getValue(), equalTo(((Long) higestSortValue).doubleValue()));
higestSortValue -= 10; higestSortValue -= 10;
@ -544,7 +544,7 @@ public class TopHitsIT extends ESIntegTestCase {
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
assertThat(terms.getBuckets().size(), equalTo(3)); assertThat(terms.getBuckets().size(), equalTo(3));
Iterator<Terms.Bucket> bucketIterator = terms.getBuckets().iterator(); Iterator<? extends Terms.Bucket> bucketIterator = terms.getBuckets().iterator();
Terms.Bucket bucket = bucketIterator.next(); Terms.Bucket bucket = bucketIterator.next();
assertThat(key(bucket), equalTo("b")); assertThat(key(bucket), equalTo("b"));
TopHits topHits = bucket.getAggregations().get("hits"); TopHits topHits = bucket.getAggregations().get("hits");

View File

@ -140,7 +140,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -182,7 +182,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double bucketSum = 0; double bucketSum = 0;
@ -223,7 +223,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -277,7 +277,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -322,7 +322,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
InternalSimpleValue avgBucketValue = response.getAggregations().get("avg_bucket"); InternalSimpleValue avgBucketValue = response.getAggregations().get("avg_bucket");
@ -349,7 +349,7 @@ public class AvgBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double aggTermsSum = 0; double aggTermsSum = 0;

View File

@ -211,7 +211,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -262,7 +262,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double bucketSum = 0; double bucketSum = 0;
@ -312,7 +312,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -375,7 +375,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -429,7 +429,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
ExtendedStatsBucket extendedStatsBucketValue = response.getAggregations().get("extended_stats_bucket"); ExtendedStatsBucket extendedStatsBucketValue = response.getAggregations().get("extended_stats_bucket");
@ -487,7 +487,7 @@ public class ExtendedStatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double aggTermsSum = 0; double aggTermsSum = 0;

View File

@ -149,7 +149,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -196,7 +196,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
List<String> maxKeys = new ArrayList<>(); List<String> maxKeys = new ArrayList<>();
@ -242,7 +242,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -348,7 +348,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -397,7 +397,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
InternalBucketMetricValue maxBucketValue = response.getAggregations().get("max_bucket"); InternalBucketMetricValue maxBucketValue = response.getAggregations().get("max_bucket");
@ -425,7 +425,7 @@ public class MaxBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
List<String> maxTermsKeys = new ArrayList<>(); List<String> maxTermsKeys = new ArrayList<>();

View File

@ -146,7 +146,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -193,7 +193,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
List<String> minKeys = new ArrayList<>(); List<String> minKeys = new ArrayList<>();
@ -239,7 +239,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -298,7 +298,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -347,7 +347,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
InternalBucketMetricValue minBucketValue = response.getAggregations().get("min_bucket"); InternalBucketMetricValue minBucketValue = response.getAggregations().get("min_bucket");
@ -375,7 +375,7 @@ public class MinBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
List<String> minTermsKeys = new ArrayList<>(); List<String> minTermsKeys = new ArrayList<>();

View File

@ -145,7 +145,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -187,7 +187,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double[] values = new double[interval]; double[] values = new double[interval];
@ -220,7 +220,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double[] values = new double[interval]; double[] values = new double[interval];
@ -261,7 +261,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -316,7 +316,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -361,7 +361,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
PercentilesBucket percentilesBucketValue = response.getAggregations().get("percentiles_bucket"); PercentilesBucket percentilesBucketValue = response.getAggregations().get("percentiles_bucket");
@ -384,7 +384,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
PercentilesBucket percentilesBucketValue = response.getAggregations().get("percentiles_bucket"); PercentilesBucket percentilesBucketValue = response.getAggregations().get("percentiles_bucket");
@ -479,7 +479,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double[] values = new double[termsBuckets.size()]; double[] values = new double[termsBuckets.size()];
@ -539,7 +539,7 @@ public class PercentilesBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double[] values = new double[termsBuckets.size()]; double[] values = new double[termsBuckets.size()];

View File

@ -147,7 +147,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -195,7 +195,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double bucketSum = 0; double bucketSum = 0;
@ -242,7 +242,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -302,7 +302,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -353,7 +353,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
StatsBucket statsBucketValue = response.getAggregations().get("stats_bucket"); StatsBucket statsBucketValue = response.getAggregations().get("stats_bucket");
@ -380,7 +380,7 @@ public class StatsBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double aggTermsSum = 0; double aggTermsSum = 0;

View File

@ -137,7 +137,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -176,7 +176,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(interval)); assertThat(buckets.size(), equalTo(interval));
double bucketSum = 0; double bucketSum = 0;
@ -214,7 +214,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -265,7 +265,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
for (int i = 0; i < interval; ++i) { for (int i = 0; i < interval; ++i) {
@ -307,7 +307,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> buckets = terms.getBuckets(); List<? extends Terms.Bucket> buckets = terms.getBuckets();
assertThat(buckets.size(), equalTo(0)); assertThat(buckets.size(), equalTo(0));
InternalSimpleValue sumBucketValue = response.getAggregations().get("sum_bucket"); InternalSimpleValue sumBucketValue = response.getAggregations().get("sum_bucket");
@ -334,7 +334,7 @@ public class SumBucketIT extends ESIntegTestCase {
Terms terms = response.getAggregations().get("terms"); Terms terms = response.getAggregations().get("terms");
assertThat(terms, notNullValue()); assertThat(terms, notNullValue());
assertThat(terms.getName(), equalTo("terms")); assertThat(terms.getName(), equalTo("terms"));
List<Terms.Bucket> termsBuckets = terms.getBuckets(); List<? extends Terms.Bucket> termsBuckets = terms.getBuckets();
assertThat(termsBuckets.size(), equalTo(interval)); assertThat(termsBuckets.size(), equalTo(interval));
double aggTermsSum = 0; double aggTermsSum = 0;