diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogram.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogram.java index 0eb969386a2..b36e82c4dcb 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogram.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/DateHistogram.java @@ -20,7 +20,7 @@ package org.elasticsearch.search.aggregations.bucket.histogram; import org.joda.time.DateTime; -import java.util.Collection; +import java.util.List; /** * A {@code date_histogram} aggregation. @@ -37,7 +37,7 @@ public interface DateHistogram extends Histogram { } @Override - Collection getBuckets(); + List getBuckets(); @Override Bucket getBucketByKey(String key); diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/Histogram.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/Histogram.java index d0c2413bc57..4a08321f80b 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/Histogram.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/Histogram.java @@ -21,8 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.histogram; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import java.util.Collection; import java.util.Comparator; +import java.util.List; /** * A {@code histogram} aggregation. Defines multiple buckets, each representing an interval in a histogram. @@ -44,7 +44,7 @@ public interface Histogram extends MultiBucketsAggregation { /** * @return The buckets of this histogram (each bucket representing an interval in the histogram) */ - Collection getBuckets(); + List getBuckets(); /** * Returns a bucket by the key associated with it. diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java index ef394384063..21d5828bc19 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java @@ -40,7 +40,6 @@ import org.elasticsearch.search.aggregations.support.format.ValueFormatterStream import java.io.IOException; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.ListIterator; @@ -230,7 +229,7 @@ public class InternalHistogram extends Inter } @Override - public Collection getBuckets() { + public List getBuckets() { return buckets; } diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java index 4f58575a5df..5ee02c03d27 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java @@ -120,9 +120,9 @@ public abstract class InternalTerms extends InternalAggregation implements Terms } @Override - public Collection getBuckets() { + public List getBuckets() { Object o = buckets; - return (Collection) o; + return (List) o; } @Override diff --git a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/Terms.java b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/Terms.java index 5344c0f8aac..0d1ae87ba60 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/Terms.java +++ b/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/Terms.java @@ -22,8 +22,8 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import java.util.Collection; import java.util.Comparator; +import java.util.List; /** * A {@code terms} aggregation. Defines multiple bucket, each associated with a unique term for a specific field. @@ -70,7 +70,10 @@ public interface Terms extends MultiBucketsAggregation { } - Collection getBuckets(); + /** + * Return the sorted list of the buckets in this terms aggregation. + */ + List getBuckets(); Bucket getBucketByKey(String term);