public class AggregationPath
extends java.lang.Object
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 under agg3
.
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 of agg3
.
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 of agg3
.
Modifier and Type | Class and Description |
---|---|
static class |
AggregationPath.PathElement |
Constructor and Description |
---|
AggregationPath(java.util.List<AggregationPath.PathElement> tokens) |
Modifier and Type | Method and Description |
---|---|
java.util.List<AggregationPath.PathElement> |
getPathElements() |
java.util.List<java.lang.String> |
getPathElementsAsStringList() |
AggregationPath.PathElement |
lastPathElement() |
static AggregationPath |
parse(java.lang.String path) |
Aggregator |
resolveAggregator(Aggregator root)
Resolves the aggregator pointed by this path using the given root as a point of reference.
|
Aggregator |
resolveTopmostAggregator(Aggregator root)
Resolves the topmost aggregator pointed by this path using the given root as a point of reference.
|
double |
resolveValue(HasAggregations root)
Resolves the value pointed by this path given an aggregations root
|
AggregationPath |
subPath(int offset,
int length) |
java.lang.String |
toString() |
void |
validate(Aggregator root)
Validates this path over the given aggregator as a point of reference.
|
public AggregationPath(java.util.List<AggregationPath.PathElement> tokens)
public static AggregationPath parse(java.lang.String path)
public java.lang.String toString()
toString
in class java.lang.Object
public AggregationPath.PathElement lastPathElement()
public java.util.List<AggregationPath.PathElement> getPathElements()
public java.util.List<java.lang.String> getPathElementsAsStringList()
public AggregationPath subPath(int offset, int length)
public double resolveValue(HasAggregations root)
root
- The root that serves as a point of reference for this pathpublic Aggregator resolveAggregator(Aggregator root)
root
- The point of reference of this pathpublic Aggregator resolveTopmostAggregator(Aggregator root)
root
- The point of reference of this pathpublic void validate(Aggregator root)
root
- The point of reference of this path