Class BucketOrder
java.lang.Object
org.elasticsearch.search.aggregations.BucketOrder
- All Implemented Interfaces:
Writeable,ToXContent,ToXContentObject
- Direct Known Subclasses:
InternalOrder,InternalOrder.CompoundOrder
public abstract class BucketOrder extends java.lang.Object implements ToXContentObject, Writeable
MultiBucketsAggregation.Bucket Ordering strategy.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
-
Constructor Summary
Constructors Constructor Description BucketOrder() -
Method Summary
Modifier and Type Method Description static BucketOrderaggregation(java.lang.String path, boolean asc)Creates a bucket ordering strategy which sorts buckets based on a single-valued sub-aggregation.static BucketOrderaggregation(java.lang.String path, java.lang.String metricName, boolean asc)Creates a bucket ordering strategy which sorts buckets based on a metric from a multi-valued sub-aggregation.abstract java.util.Comparator<MultiBucketsAggregation.Bucket>comparator(Aggregator aggregator)static BucketOrdercompound(java.util.List<BucketOrder> orders)Creates a bucket ordering strategy which sorts buckets based on multiple criteria.static BucketOrdercompound(BucketOrder... orders)Creates a bucket ordering strategy which sorts buckets based on multiple criteria.static BucketOrdercount(boolean asc)Creates a bucket ordering strategy that sorts buckets by their document counts (ascending or descending).abstract booleanequals(java.lang.Object obj)abstract inthashCode()static BucketOrderkey(boolean asc)Creates a bucket ordering strategy that sorts buckets by their keys (ascending or descending).java.lang.StringtoString()voidwriteTo(StreamOutput out)Write this into the StreamOutput.
-
Constructor Details
-
BucketOrder
public BucketOrder()
-
-
Method Details
-
count
Creates a bucket ordering strategy that sorts buckets by their document counts (ascending or descending).- Parameters:
asc- direction to sort by:truefor ascending,falsefor descending.
-
key
Creates a bucket ordering strategy that sorts buckets by their keys (ascending or descending). This may be used as a tie-breaker to avoid non-deterministic ordering.- Parameters:
asc- direction to sort by:truefor ascending,falsefor descending.
-
aggregation
Creates a bucket ordering strategy which sorts buckets based on a single-valued sub-aggregation.- Parameters:
path- path to the sub-aggregation to sort on.asc- direction to sort by:truefor ascending,falsefor descending.- See Also:
AggregationPath
-
aggregation
public static BucketOrder aggregation(java.lang.String path, java.lang.String metricName, boolean asc)Creates a bucket ordering strategy which sorts buckets based on a metric from a multi-valued sub-aggregation.- Parameters:
path- path to the sub-aggregation to sort on.metricName- name of the value of the multi-value metric to sort on.asc- direction to sort by:truefor ascending,falsefor descending.- See Also:
AggregationPath
-
compound
Creates a bucket ordering strategy which sorts buckets based on multiple criteria. A tie-breaker may be added to avoid non-deterministic ordering.- Parameters:
orders- a list ofBucketOrderobjects to sort on, in order of priority.
-
compound
Creates a bucket ordering strategy which sorts buckets based on multiple criteria. A tie-breaker may be added to avoid non-deterministic ordering.- Parameters:
orders- a list ofBucketOrderparameters to sort on, in order of priority.
-
comparator
public abstract java.util.Comparator<MultiBucketsAggregation.Bucket> comparator(Aggregator aggregator)- Returns:
- A comparator for the bucket based on the given aggregator. The comparator is used in two phases:
- aggregation phase, where each shard builds a list of buckets to be sent to the coordinating node. In this phase, the passed in aggregator will be the aggregator that aggregates the buckets on the shard level.
- reduce phase, where the coordinating node gathers all the buckets from all the shards and reduces them to a final bucket list. In this case, the passed in aggregator will be
null.
-
hashCode
public abstract int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public abstract boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput. -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-