Class InternalOrder.Aggregation

All Implemented Interfaces:
Writeable, org.elasticsearch.xcontent.ToXContent, org.elasticsearch.xcontent.ToXContentObject
Enclosing class:
InternalOrder

public static class InternalOrder.Aggregation extends InternalOrder
MultiBucketsAggregation.Bucket ordering strategy to sort by a sub-aggregation.
  • Method Details

    • path

      public AggregationPath path()
    • 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
    • toXContent

      public org.elasticsearch.xcontent.XContentBuilder toXContent(org.elasticsearch.xcontent.XContentBuilder builder, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException
      Throws:
      IOException
    • hashCode

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

      public boolean equals(Object obj)
      Specified by:
      equals in class BucketOrder