Class InternalOrder.CompoundOrder

java.lang.Object
org.elasticsearch.search.aggregations.BucketOrder
org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder
All Implemented Interfaces:
Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject
Enclosing class:
InternalOrder

public static class InternalOrder.CompoundOrder
extends BucketOrder
MultiBucketsAggregation.Bucket ordering strategy to sort by multiple criteria.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Method Summary

    Modifier and Type Method Description
    java.util.Comparator<MultiBucketsAggregation.Bucket> comparator()
    Build a comparator for fully built buckets.
    boolean equals​(java.lang.Object obj)  
    int hashCode()  
    java.util.List<BucketOrder> orderElements()  
    <T extends MultiBucketsAggregation.Bucket>
    java.util.Comparator<T>
    partiallyBuiltBucketComparator​(java.util.function.ToLongFunction<T> ordinalReader, Aggregator aggregator)
    A builds comparator comparing buckets partially built buckets by delegating comparison of the results of any "child" aggregations to the provided Aggregator.
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  

    Methods inherited from class org.elasticsearch.search.aggregations.BucketOrder

    aggregation, aggregation, compound, compound, count, key, toString, validate, writeTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment
  • Method Details

    • orderElements

      public java.util.List<BucketOrder> orderElements()
      Returns:
      unmodifiable list of BucketOrders to sort on.
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException
    • partiallyBuiltBucketComparator

      public <T extends MultiBucketsAggregation.Bucket> java.util.Comparator<T> partiallyBuiltBucketComparator​(java.util.function.ToLongFunction<T> ordinalReader, Aggregator aggregator)
      Description copied from class: BucketOrder
      A builds comparator comparing buckets partially built buckets by delegating comparison of the results of any "child" aggregations to the provided Aggregator.

      Warning: This is fairly difficult to use and impossible to use cleanly. In addition, this exists primarily to return the "top n" buckets based on the results of a sub aggregation. The trouble is that could end up throwing away buckets on the data nodes that should ultimately be kept after reducing all of the results. If you know that this is coming it is fine, but most folks that use "generic" sorts don't. In other words: before you use this method think super duper hard if you want to have these kinds of issues. The terms agg does an folks get into trouble with it all the time.

      Specified by:
      partiallyBuiltBucketComparator in class BucketOrder
    • comparator

      public java.util.Comparator<MultiBucketsAggregation.Bucket> comparator()
      Description copied from class: BucketOrder
      Build a comparator for fully built buckets.
      Specified by:
      comparator in class BucketOrder
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class BucketOrder
    • equals

      public boolean equals​(java.lang.Object obj)
      Specified by:
      equals in class BucketOrder