public class InternalOrder extends BucketOrder
MultiBucketsAggregation.Bucket
ordering strategies.Modifier and Type | Class and 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.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field and Description |
---|---|
protected boolean |
asc |
protected java.util.Comparator<MultiBucketsAggregation.Bucket> |
comparator |
EMPTY_PARAMS
Constructor and Description |
---|
InternalOrder(byte id,
java.lang.String key,
boolean asc,
java.util.Comparator<MultiBucketsAggregation.Bucket> comparator)
Creates an ordering strategy that sorts
MultiBucketsAggregation.Bucket s by some property. |
Modifier and Type | Method and 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, writeTo
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isFragment
protected 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.Bucket
s 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.IOException
public 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 BucketOrder
public boolean equals(java.lang.Object obj)
equals
in class BucketOrder