Java Code Examples for org.elasticsearch.search.aggregations.Aggregator#parent()

The following examples show how to use org.elasticsearch.search.aggregations.Aggregator#parent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CardinalityAggregatorFactory.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static int defaultPrecision(Aggregator parent) {
    int precision = HyperLogLogPlusPlus.DEFAULT_PRECISION;
    while (parent != null) {
        if (parent instanceof SingleBucketAggregator == false) {
            // if the parent creates buckets, we substract 5 to the precision,
            // which will effectively divide the memory usage of each counter by 32
            precision -= 5;
        }
        parent = parent.parent();
    }

    return Math.max(precision, HyperLogLogPlusPlus.MIN_PRECISION);
}
 
Example 2
Source File: ReverseNestedAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static NestedAggregator findClosestNestedAggregator(Aggregator parent) {
    for (; parent != null; parent = parent.parent()) {
        if (parent instanceof NestedAggregator) {
            return (NestedAggregator) parent;
        }
    }
    return null;
}
 
Example 3
Source File: NestedAggregator.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private static Query findClosestNestedPath(Aggregator parent) {
    for (; parent != null; parent = parent.parent()) {
        if (parent instanceof NestedAggregator) {
            return ((NestedAggregator) parent).childFilter;
        } else if (parent instanceof ReverseNestedAggregator) {
            return ((ReverseNestedAggregator) parent).getParentFilter();
        }
    }
    return null;
}