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.
  • Method Details

    • orderElements

      public 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 IOException
      Throws:
      IOException
    • partiallyBuiltBucketComparator

      public <T extends MultiBucketsAggregation.Bucket> Comparator<T> partiallyBuiltBucketComparator(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

      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(Object obj)
      Specified by:
      equals in class BucketOrder