org.elasticsearch.search.aggregations.bucket.range.InternalRange Java Examples

The following examples show how to use org.elasticsearch.search.aggregations.bucket.range.InternalRange. 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: GeoDistanceParser.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
public GeoDistanceFactory(String name, ValuesSourceConfig<ValuesSource.GeoPoint> valueSourceConfig,
                          InternalRange.Factory rangeFactory, GeoPoint origin, DistanceUnit unit, GeoDistance distanceType,
                          List<RangeAggregator.Range> ranges, boolean keyed) {
    super(name, rangeFactory.type(), valueSourceConfig);
    this.origin = origin;
    this.unit = unit;
    this.distanceType = distanceType;
    this.rangeFactory = rangeFactory;
    this.ranges = ranges;
    this.keyed = keyed;
}
 
Example #2
Source File: InternalGeoDistance.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected InternalRange.Factory<Bucket, ?> getFactory() {
    return FACTORY;
}
 
Example #3
Source File: InternalGeoDistance.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public InternalRange.Factory<Bucket, InternalGeoDistance> getFactory() {
    return FACTORY;
}
 
Example #4
Source File: InternalIPv4Range.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected InternalRange.Factory<Bucket, ?> getFactory() {
    return FACTORY;
}
 
Example #5
Source File: InternalIPv4Range.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public InternalRange.Factory<Bucket, InternalIPv4Range> getFactory() {
    return FACTORY;
}
 
Example #6
Source File: InternalDateRange.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
protected InternalRange.Factory<Bucket, ?> getFactory() {
    return FACTORY;
}
 
Example #7
Source File: InternalDateRange.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public InternalRange.Factory<Bucket, InternalDateRange> getFactory() {
    return FACTORY;
}
 
Example #8
Source File: ElasticsearchGraphQueryIterable.java    From vertexium with Apache License 2.0 4 votes vote down vote up
private static AggregationResult reduceAggregationResults(ElasticsearchSearchQueryBase query, org.vertexium.query.Aggregation queryAgg, List<Aggregation> resultAggs) {
    if (resultAggs.size() == 0) {
        throw new VertexiumException("Cannot reduce zero sized aggregation list");
    }

    Object aggType = queryAgg;
    if (queryAgg == null) {
        Aggregation first = resultAggs.get(0);
        if (first.getName().endsWith(AGGREGATION_HAS_NOT_SUFFIX)) {
            if (resultAggs.size() > 1) {
                first = resultAggs.get(1);
            } else {
                throw new VertexiumException("Unhandled aggregation. Found HasNot filter with no associated aggregations and no query aggregation.");
            }
        }
        aggType = first;
    }

    if (aggType instanceof HistogramAggregation || aggType instanceof CalendarFieldAggregation ||
        aggType instanceof InternalHistogram || aggType instanceof InternalDateHistogram) {
        return reduceHistogramResults(query, resultAggs);
    }
    if (aggType instanceof RangeAggregation || aggType instanceof InternalRange) {
        return reduceRangeResults(query, resultAggs);
    }
    if (aggType instanceof PercentilesAggregation || aggType instanceof Percentiles) {
        return reducePercentilesResults(query, resultAggs);
    }
    if (aggType instanceof TermsAggregation || aggType instanceof InternalTerms) {
        return reduceTermsResults(query, resultAggs);
    }
    if (aggType instanceof GeohashAggregation || aggType instanceof InternalGeoHashGrid) {
        return reduceGeohashResults(query, resultAggs);
    }
    if (aggType instanceof StatisticsAggregation || aggType instanceof InternalExtendedStats) {
        return reduceStatisticsResults(resultAggs);
    }
    if (aggType instanceof CardinalityAggregation || aggType instanceof InternalCardinality) {
        return reduceCardinalityResults(query, resultAggs);
    }
    throw new VertexiumException("Unhandled aggregation type: " + aggType.getClass().getName());
}
 
Example #9
Source File: ElasticsearchGraphQueryIterable.java    From vertexium with Apache License 2.0 4 votes vote down vote up
private static AggregationResult reduceAggregationResults(ElasticsearchSearchQueryBase query, org.vertexium.query.Aggregation queryAgg, List<Aggregation> resultAggs) {
    if (resultAggs.size() == 0) {
        throw new VertexiumException("Cannot reduce zero sized aggregation list");
    }

    Object aggType = queryAgg;
    if (queryAgg == null) {
        Aggregation first = resultAggs.get(0);
        if (first.getName().endsWith(AGGREGATION_HAS_NOT_SUFFIX)) {
            if (resultAggs.size() > 1) {
                first = resultAggs.get(1);
            } else {
                throw new VertexiumException("Unhandled aggregation. Found HasNot filter with no associated aggregations and no query aggregation.");
            }
        }
        aggType = first;
    }

    if (aggType instanceof HistogramAggregation || aggType instanceof CalendarFieldAggregation ||
        aggType instanceof InternalHistogram || aggType instanceof InternalDateHistogram) {
        return reduceHistogramResults(query, resultAggs);
    }
    if (aggType instanceof RangeAggregation || aggType instanceof InternalRange) {
        return reduceRangeResults(query, resultAggs);
    }
    if (aggType instanceof PercentilesAggregation || aggType instanceof Percentiles) {
        return reducePercentilesResults(query, resultAggs);
    }
    if (aggType instanceof TermsAggregation || aggType instanceof InternalTerms) {
        return reduceTermsResults(query, resultAggs);
    }
    if (aggType instanceof GeohashAggregation || aggType instanceof InternalGeoHashGrid) {
        return reduceGeohashResults(query, resultAggs);
    }
    if (aggType instanceof StatisticsAggregation || aggType instanceof InternalExtendedStats) {
        return reduceStatisticsResults(resultAggs);
    }
    if (aggType instanceof CardinalityAggregation || aggType instanceof InternalCardinality) {
        return reduceCardinalityResults(query, resultAggs);
    }
    throw new VertexiumException("Unhandled aggregation type: " + aggType.getClass().getName());
}