Writeable, ToXContent, ToXContentObjectInternalOrder.Aggregationpublic class InternalOrder extends BucketOrder
MultiBucketsAggregation.Bucket ordering strategies.| Modifier and Type | Class | Description |
|---|---|---|
static class |
InternalOrder.Aggregation |
MultiBucketsAggregation.Bucket ordering strategy to sort by a sub-aggregation. |
static class |
InternalOrder.CompoundOrder |
MultiBucketsAggregation.Bucket ordering strategy to sort by multiple criteria. |
static class |
InternalOrder.Parser |
Contains logic for parsing a
BucketOrder from a XContentParser. |
static class |
InternalOrder.Streams |
Contains logic for reading/writing
BucketOrder from/to streams. |
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsWriteable.Reader<V>, Writeable.Writer<V>| Modifier and Type | Field | Description |
|---|---|---|
protected boolean |
asc |
|
protected java.util.Comparator<MultiBucketsAggregation.Bucket> |
comparator |
EMPTY_PARAMS| Constructor | Description |
|---|---|
InternalOrder(byte id,
java.lang.String key,
boolean asc,
java.util.Comparator<MultiBucketsAggregation.Bucket> comparator) |
Creates an ordering strategy that sorts
MultiBucketsAggregation.Buckets by some property. |
| Modifier and Type | Method | Description |
|---|---|---|
java.util.Comparator<MultiBucketsAggregation.Bucket> |
comparator(Aggregator aggregator) |
|
boolean |
equals(java.lang.Object obj) |
|
int |
hashCode() |
|
static boolean |
isCountDesc(BucketOrder order) |
Determine if the ordering strategy is sorting on bucket count descending.
|
static boolean |
isKeyAsc(BucketOrder order) |
Determine if the ordering strategy is sorting on bucket key ascending.
|
static boolean |
isKeyDesc(BucketOrder order) |
Determine if the ordering strategy is sorting on bucket key descending.
|
static boolean |
isKeyOrder(BucketOrder order) |
Determine if the ordering strategy is sorting on bucket key (ascending or descending).
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
static BucketOrder |
validate(BucketOrder order,
Aggregator aggregator) |
Validate a bucket ordering strategy for an
Aggregator. |
aggregation, aggregation, compound, compound, count, key, toString, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentprotected final boolean asc
protected final java.util.Comparator<MultiBucketsAggregation.Bucket> comparator
public InternalOrder(byte id,
java.lang.String key,
boolean asc,
java.util.Comparator<MultiBucketsAggregation.Bucket> comparator)
MultiBucketsAggregation.Buckets by some property.id - unique ID for this ordering strategy.key - key of the property to sort on.asc - direction to sort by: true for ascending, false for descending.comparator - determines how buckets will be ordered.public java.util.Comparator<MultiBucketsAggregation.Bucket> comparator(Aggregator aggregator)
comparator in class BucketOrder- 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.
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOExceptionpublic static BucketOrder validate(BucketOrder order, Aggregator aggregator) throws AggregationExecutionException
Aggregator.order - bucket ordering strategy to sort on.aggregator - aggregator to sort.AggregationExecutionException - if validation failspublic static boolean isCountDesc(BucketOrder order)
order - bucket ordering strategy to check.true if the ordering strategy is sorting on bucket count descending, false otherwise.public static boolean isKeyOrder(BucketOrder order)
order - bucket ordering strategy to check.true if the ordering strategy is sorting on bucket key, false otherwise.public static boolean isKeyAsc(BucketOrder order)
order - bucket ordering strategy to check.true if the ordering strategy is sorting on bucket key ascending, false otherwise.public static boolean isKeyDesc(BucketOrder order)
order - bucket ordering strategy to check.true if the ordering strategy is sorting on bucket key descending, false otherwise.public int hashCode()
hashCode in class BucketOrderpublic boolean equals(java.lang.Object obj)
equals in class BucketOrder