Class BucketHelpers
- java.lang.Object
-
- org.elasticsearch.search.aggregations.pipeline.BucketHelpers
-
public class BucketHelpers extends java.lang.Object
A set of static helpers to simplify working with aggregation buckets, in particular providing utilities that help pipeline aggregations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BucketHelpers.GapPolicy
A gap policy determines how "holes" in a set of buckets should be handled.
-
Constructor Summary
Constructors Constructor Description BucketHelpers()
-
Method Summary
Modifier and Type Method Description static java.lang.Double
resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, java.lang.String aggPath, BucketHelpers.GapPolicy gapPolicy)
Given a path and a set of buckets, this method will return the value inside the agg at that path.static java.lang.Double
resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, java.util.List<java.lang.String> aggPathAsList, BucketHelpers.GapPolicy gapPolicy)
-
-
-
Method Detail
-
resolveBucketValue
public static java.lang.Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, java.lang.String aggPath, BucketHelpers.GapPolicy gapPolicy)
Given a path and a set of buckets, this method will return the value inside the agg at that path. This is used to extract values for use by pipeline aggregations (e.g. a derivative might need the price for each bucket). If the bucket is empty, the configured GapPolicy is invoked to resolve the missing bucket- Parameters:
agg
- A series of agg buckets in the form of a histogrambucket
- A specific bucket that a value needs to be extracted from. This bucket should be present in thehisto
parameteraggPath
- The path to a particular value that needs to be extracted. This path should point to a metric inside thebucket
gapPolicy
- The gap policy to apply if empty buckets are found- Returns:
- The value extracted from
bucket
found ataggPath
-
resolveBucketValue
public static java.lang.Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, java.util.List<java.lang.String> aggPathAsList, BucketHelpers.GapPolicy gapPolicy)
-
-