public abstract Object getProperty(List<String> path);
/** * 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 * * @param agg * A series of agg buckets in the form of a histogram * @param bucket * A specific bucket that a value needs to be extracted from. * This bucket should be present in the <code>histo</code> * parameter * @param aggPath * The path to a particular value that needs to be extracted. * This path should point to a metric inside the * <code>bucket</code> * @param gapPolicy * The gap policy to apply if empty buckets are found * @return The value extracted from <code>bucket</code> found at * <code>aggPath</code> */ public static Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, String aggPath, GapPolicy gapPolicy) { List<String> aggPathsList = AggregationPath.parse(aggPath).getPathElementsAsStringList(); return resolveBucketValue(agg, bucket, aggPathsList, gapPolicy); }
@Override public final InternalAggregation doReduce(Aggregations aggregations, ReduceContext context) { preCollection(); List<String> bucketsPath = AggregationPath.parse(bucketsPaths()[0]).getPathElementsAsStringList(); for (Aggregation aggregation : aggregations) { if (aggregation.getName().equals(bucketsPath.get(0))) { List<String> sublistedPath = bucketsPath.subList(1, bucketsPath.size()); InternalMultiBucketAggregation<?, ?> multiBucketsAgg = (InternalMultiBucketAggregation<?, ?>) aggregation; List<? extends InternalMultiBucketAggregation.InternalBucket> buckets = multiBucketsAgg.getBuckets(); for (InternalMultiBucketAggregation.InternalBucket bucket : buckets) { Double bucketValue = BucketHelpers.resolveBucketValue(multiBucketsAgg, bucket, sublistedPath, gapPolicy); if (bucketValue != null && !Double.isNaN(bucketValue)) { collectBucketValue(bucket.getKeyAsString(), bucketValue); } } } } return buildAggregation(Collections.emptyList(), metaData()); }
@Override public Object getProperty(String path) { AggregationPath aggPath = AggregationPath.parse(path); return getProperty(aggPath.getPathElementsAsStringList()); }
public abstract Object getProperty(List<String> path);
public abstract Object getProperty(List<String> path);
public abstract Object getProperty(List<String> path);
public abstract Object getProperty(List<String> path);
/** * 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 * * @param agg * A series of agg buckets in the form of a histogram * @param bucket * A specific bucket that a value needs to be extracted from. * This bucket should be present in the <code>histo</code> * parameter * @param aggPath * The path to a particular value that needs to be extracted. * This path should point to a metric inside the * <code>bucket</code> * @param gapPolicy * The gap policy to apply if empty buckets are found * @return The value extracted from <code>bucket</code> found at * <code>aggPath</code> */ public static Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, String aggPath, GapPolicy gapPolicy) { List<String> aggPathsList = AggregationPath.parse(aggPath).getPathElementsAsStringList(); return resolveBucketValue(agg, bucket, aggPathsList, 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 * * @param agg * A series of agg buckets in the form of a histogram * @param bucket * A specific bucket that a value needs to be extracted from. * This bucket should be present in the <code>histo</code> * parameter * @param aggPath * The path to a particular value that needs to be extracted. * This path should point to a metric inside the * <code>bucket</code> * @param gapPolicy * The gap policy to apply if empty buckets are found * @return The value extracted from <code>bucket</code> found at * <code>aggPath</code> */ public static Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, String aggPath, GapPolicy gapPolicy) { List<String> aggPathsList = AggregationPath.parse(aggPath).getPathElementsAsStringList(); return resolveBucketValue(agg, bucket, aggPathsList, 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 * * @param agg * A series of agg buckets in the form of a histogram * @param bucket * A specific bucket that a value needs to be extracted from. * This bucket should be present in the <code>histo</code> * parameter * @param aggPath * The path to a particular value that needs to be extracted. * This path should point to a metric inside the * <code>bucket</code> * @param gapPolicy * The gap policy to apply if empty buckets are found * @return The value extracted from <code>bucket</code> found at * <code>aggPath</code> */ public static Double resolveBucketValue(InternalMultiBucketAggregation<?, ? extends InternalMultiBucketAggregation.Bucket> agg, InternalMultiBucketAggregation.Bucket bucket, String aggPath, GapPolicy gapPolicy) { List<String> aggPathsList = AggregationPath.parse(aggPath).getPathElementsAsStringList(); return resolveBucketValue(agg, bucket, aggPathsList, 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 * * @param agg * A series of agg buckets in the form of a histogram * @param bucket * A specific bucket that a value needs to be extracted from. * This bucket should be present in the <code>histo</code> * parameter * @param aggPath * The path to a particular value that needs to be extracted. * This path should point to a metric inside the * <code>bucket</code> * @param gapPolicy * The gap policy to apply if empty buckets are found * @return The value extracted from <code>bucket</code> found at * <code>aggPath</code> */ public static Double resolveBucketValue(MultiBucketsAggregation agg, InternalMultiBucketAggregation.InternalBucket bucket, String aggPath, GapPolicy gapPolicy) { List<String> aggPathsList = AggregationPath.parse(aggPath).getPathElementsAsStringList(); return resolveBucketValue(agg, bucket, aggPathsList, gapPolicy); }
@Override public final InternalAggregation doReduce(Aggregations aggregations, ReduceContext context) { preCollection(); List<String> bucketsPath = AggregationPath.parse(bucketsPaths()[0]).getPathElementsAsStringList(); for (Aggregation aggregation : aggregations) { if (aggregation.getName().equals(bucketsPath.get(0))) { bucketsPath = bucketsPath.subList(1, bucketsPath.size()); InternalMultiBucketAggregation<?, ?> multiBucketsAgg = (InternalMultiBucketAggregation<?, ?>) aggregation; List<? extends InternalMultiBucketAggregation.InternalBucket> buckets = multiBucketsAgg.getBuckets(); for (InternalMultiBucketAggregation.InternalBucket bucket : buckets) { Double bucketValue = BucketHelpers.resolveBucketValue(multiBucketsAgg, bucket, bucketsPath, gapPolicy); if (bucketValue != null && !Double.isNaN(bucketValue)) { collectBucketValue(bucket.getKeyAsString(), bucketValue); } } } } return buildAggregation(Collections.emptyList(), metaData()); }
@Override public final InternalAggregation doReduce(Aggregations aggregations, ReduceContext context) { preCollection(); List<String> bucketsPath = AggregationPath.parse(bucketsPaths()[0]).getPathElementsAsStringList(); for (Aggregation aggregation : aggregations) { if (aggregation.getName().equals(bucketsPath.get(0))) { List<String> sublistedPath = bucketsPath.subList(1, bucketsPath.size()); InternalMultiBucketAggregation<?, ?> multiBucketsAgg = (InternalMultiBucketAggregation<?, ?>) aggregation; List<? extends InternalMultiBucketAggregation.InternalBucket> buckets = multiBucketsAgg.getBuckets(); for (InternalMultiBucketAggregation.InternalBucket bucket : buckets) { Double bucketValue = BucketHelpers.resolveBucketValue(multiBucketsAgg, bucket, sublistedPath, gapPolicy); if (bucketValue != null && !Double.isNaN(bucketValue)) { collectBucketValue(bucket.getKeyAsString(), bucketValue); } } } } return buildAggregation(Collections.emptyList(), metaData()); }
@Override public final InternalAggregation doReduce(Aggregations aggregations, ReduceContext context) { preCollection(); List<String> bucketsPath = AggregationPath.parse(bucketsPaths()[0]).getPathElementsAsStringList(); for (Aggregation aggregation : aggregations) { if (aggregation.getName().equals(bucketsPath.get(0))) { bucketsPath = bucketsPath.subList(1, bucketsPath.size()); InternalMultiBucketAggregation multiBucketsAgg = (InternalMultiBucketAggregation) aggregation; List<? extends Bucket> buckets = multiBucketsAgg.getBuckets(); for (int i = 0; i < buckets.size(); i++) { Bucket bucket = buckets.get(i); Double bucketValue = BucketHelpers.resolveBucketValue(multiBucketsAgg, bucket, bucketsPath, gapPolicy); if (bucketValue != null && !Double.isNaN(bucketValue)) { collectBucketValue(bucket.getKeyAsString(), bucketValue); } } } } return buildAggregation(Collections.EMPTY_LIST, metaData()); }
@Override public final InternalAggregation doReduce(Aggregations aggregations, ReduceContext context) { preCollection(); List<String> bucketsPath = AggregationPath.parse(bucketsPaths()[0]).getPathElementsAsStringList(); for (Aggregation aggregation : aggregations) { if (aggregation.getName().equals(bucketsPath.get(0))) { List<String> sublistedPath = bucketsPath.subList(1, bucketsPath.size()); InternalMultiBucketAggregation<?, ?> multiBucketsAgg = (InternalMultiBucketAggregation<?, ?>) aggregation; List<? extends InternalMultiBucketAggregation.InternalBucket> buckets = multiBucketsAgg.getBuckets(); for (InternalMultiBucketAggregation.InternalBucket bucket : buckets) { Double bucketValue = BucketHelpers.resolveBucketValue(multiBucketsAgg, bucket, sublistedPath, gapPolicy); if (bucketValue != null && !Double.isNaN(bucketValue)) { collectBucketValue(bucket.getKeyAsString(), bucketValue); } } } } return buildAggregation(Collections.emptyList(), metaData()); }