Module org.elasticsearch.server
Class AggregationPath
java.lang.Object
org.elasticsearch.search.aggregations.support.AggregationPath
A path that can be used to sort/order buckets (in some multi-bucket aggregations, e.g. terms & histogram) based on
sub-aggregations. The path may point to either a single-bucket aggregation or a metrics aggregation. If the path
points to a single-bucket aggregation, the sort will be applied based on the
doc_count
of the bucket. If this
path points to a metrics aggregation, if it's a single-value metrics (eg. avg, max, min, etc..) the sort will be
applied on that single value. If it points to a multi-value metrics, the path should point out what metric should be
the sort-by value.
The path has the following form:
<aggregation_name>['>'<aggregation_name>*]['.'<metric_name>]
Examples:
-
agg1>agg2>agg3
- where agg1, agg2 and agg3 are all single-bucket aggs (eg filter, nested, missing, etc..). In this case, the order will be based on the number of documents underagg3
. -
agg1>agg2>agg3
- where agg1 and agg2 are both single-bucket aggs and agg3 is a single-value metrics agg (eg avg, max, min, etc..). In this case, the order will be based on the value ofagg3
. -
agg1>agg2>agg3.avg
- where agg1 and agg2 are both single-bucket aggs and agg3 is a multi-value metrics agg (eg stats, extended_stats, etc...). In this case, the order will be based on the avg value ofagg3
. -
agg1["foo"]>agg2>agg3.avg
- where agg1 is multi-bucket, and the path expects a bucket "foo", agg2 are both single-bucket aggs and agg3 is a multi-value metrics agg (eg stats, extended_stats, etc...). In this case, the order will be based on the avg value ofagg3
. -
agg1["foo"]._count
- where agg1 is multi-bucket, and the path expects a bucket "foo". This would extract the doc_count for that specific bucket.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbucketComparator
(Aggregator root, SortOrder order) boolean
int
hashCode()
static AggregationPath
static boolean
pathElementContainsBucketKey
(AggregationPath.PathElement pathElement) Indicates if the current path element contains a bucket key.pathElementsAsStringList
(List<AggregationPath.PathElement> pathElements) resolveAggregator
(Aggregator root) Resolves the Aggregator pointed to by this path against the given root Aggregator.Resolves the Aggregator pointed to by the first element of this path against the given root Aggregator.resolveValue
(InternalAggregations aggregations) Looks up the value of this path against a set of aggregation results.toString()
-
Constructor Details
-
AggregationPath
-
-
Method Details
-
pathElementContainsBucketKey
Indicates if the current path element contains a bucket key. InternalMultiBucketAggregation#resolvePropertyFromPath supports resolving specific buckets and a bucket is indicated by wrapping a key element in quotations. Example `agg['foo']` would get the bucket `foo` in the agg.- Parameters:
pathElement
- The path element to check- Returns:
- Does the path element contain a bucket_key or not
-
pathElementsAsStringList
-
parse
-
toString
-
lastPathElement
-
getPathElements
-
getPathElementsAsStringList
-
resolveValue
Looks up the value of this path against a set of aggregation results. -
resolveAggregator
Resolves the Aggregator pointed to by this path against the given root Aggregator. -
resolveTopmostAggregator
Resolves the Aggregator pointed to by the first element of this path against the given root Aggregator. -
bucketComparator
-
equals
-
hashCode
public int hashCode()
-