org.elasticsearch.search.aggregations.AggregatorFactories.Builder Java Examples

The following examples show how to use org.elasticsearch.search.aggregations.AggregatorFactories.Builder. 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: PredictionAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 6 votes vote down vote up
@Override
protected MultiValuesSourceAggregatorFactory<Numeric, ?> innerInnerBuild(
    final SearchContext context,
    final List<NamedValuesSourceConfigSpec<Numeric>> configs, final MultiValueMode multiValueMode,
    final AggregatorFactory<?> parent, final Builder subFactoriesBuilder) throws IOException {
  if (this.inputs == null || this.inputs.length != configs.size() - 1) {
    throw new IllegalArgumentException(
        "[inputs] must have [" + (configs.size() - 1)
            + "] values as much as the number of feature fields: ["
            + this.name
            + "]");
  }
  return new PredictionAggregatorFactory(this.name, configs, multiValueMode, this.inputs,
      context,
      parent,
      subFactoriesBuilder, this.metaData);
}
 
Example #2
Source File: PathHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 6 votes vote down vote up
@Override
protected ValuesSourceAggregatorFactory<ValuesSource> innerBuild(
        QueryShardContext context,
        ValuesSourceConfig<ValuesSource> config,
        AggregatorFactory parent,
        AggregatorFactories.Builder subFactoriesBuilder) throws IOException {

    if (minDepth > maxDepth)
        throw new IllegalArgumentException("[minDepth] (" + minDepth + ") must not be greater than [maxDepth] (" +
                maxDepth + ")");

    if (depth >= 0) {
        if (minDepth > depth)
            throw new IllegalArgumentException("[minDepth] (" + minDepth + ") must not be greater than [depth] (" +
                    depth + ")");
        minDepth = depth;
        maxDepth = depth;
    }

    return new PathHierarchyAggregatorFactory(
            name, config, separator, minDepth, maxDepth, keepBlankPath, order, minDocCount, bucketCountThresholds,
            context, parent, subFactoriesBuilder, metaData);
}
 
Example #3
Source File: DateHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 5 votes vote down vote up
private DateHierarchyAggregationBuilder(DateHierarchyAggregationBuilder clone, Builder factoriesBuilder,
                                        Map<String, Object> metaData) {
    super(clone, factoriesBuilder, metaData);
    order = clone.order;
    minDocCount = clone.minDocCount;
    this.bucketCountThresholds = new DateHierarchyAggregator.BucketCountThresholds(clone.bucketCountThresholds);
}
 
Example #4
Source File: GeoPointClusteringAggregationBuilder.java    From elasticsearch-aggregation-geoclustering with Apache License 2.0 5 votes vote down vote up
protected GeoPointClusteringAggregationBuilder(
        GeoPointClusteringAggregationBuilder clone, Builder factoriesBuilder, Map<String, Object> metaData) {
    super(clone, factoriesBuilder, metaData);
    this.zoom = clone.zoom;
    this.radius = clone.radius;
    this.extent = clone.extent;
    this.ratio = clone.ratio;
    this.requiredSize = clone.requiredSize;
    this.shardSize = clone.shardSize;
}
 
Example #5
Source File: GeoShapeBuilder.java    From elasticsearch-plugin-geoshape with MIT License 5 votes vote down vote up
@Override
protected ValuesSourceAggregatorFactory<ValuesSource> innerBuild(
        QueryShardContext queryShardContext,
        ValuesSourceConfig<ValuesSource> config,
        AggregatorFactory parent,
        AggregatorFactories.Builder subFactoriesBuilder) throws IOException {
    return new GeoShapeAggregatorFactory(
            name, config, output_format, must_simplify, simplify_zoom, simplify_algorithm,
            bucketCountThresholds, queryShardContext, parent, subFactoriesBuilder, metaData);
}
 
Example #6
Source File: GeoShapeBuilder.java    From elasticsearch-plugin-geoshape with MIT License 5 votes vote down vote up
private GeoShapeBuilder(GeoShapeBuilder clone, Builder factoriesBuilder,
                                        Map<String, Object> metaData) {
    super(clone, factoriesBuilder, metaData);
    output_format = clone.output_format;
    must_simplify = clone.must_simplify;
    simplify_zoom = clone.simplify_zoom;
    simplify_algorithm = clone.simplify_algorithm;
    this.bucketCountThresholds = new GeoShapeAggregator.BucketCountThresholds(clone.bucketCountThresholds);
}
 
Example #7
Source File: DateHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 5 votes vote down vote up
@Override
protected ValuesSourceAggregatorFactory<ValuesSource.Numeric> innerBuild(
        QueryShardContext context,
        ValuesSourceConfig<ValuesSource.Numeric> config,
        AggregatorFactory parent,
        Builder subFactoriesBuilder) throws IOException {

    final List<RoundingInfo> roundingsInfo = buildRoundings();

    return new DateHierarchyAggregatorFactory(
            name, config, order, roundingsInfo, minDocCount, bucketCountThresholds,
            context, parent, subFactoriesBuilder, metaData);
}
 
Example #8
Source File: DateHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 5 votes vote down vote up
private Rounding createRounding(Rounding.DateTimeUnit dateTimeUnit) {
    Rounding.Builder tzRoundingBuilder;
    tzRoundingBuilder = Rounding.builder(dateTimeUnit);

    if (timeZone() != null) {
        tzRoundingBuilder.timeZone(timeZone());
    }
    Rounding rounding = tzRoundingBuilder.build();
    return rounding;
}
 
Example #9
Source File: PredictionAggregatorFactory.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
public PredictionAggregatorFactory(final String name,
    final List<NamedValuesSourceConfigSpec<Numeric>> configs, final MultiValueMode multiValueMode,
    final double[] inputs, final SearchContext context, final AggregatorFactory<?> parent,
    final Builder subFactoriesBuilder,
    final Map<String, Object> metaData) throws IOException {
  super(name, configs, context, parent, subFactoriesBuilder, metaData);
  this.multiValueMode = multiValueMode;
  this.inputs = inputs;
}
 
Example #10
Source File: PathHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 5 votes vote down vote up
private PathHierarchyAggregationBuilder(PathHierarchyAggregationBuilder clone, Builder factoriesBuilder,
                                       Map<String, Object> metaData) {
    super(clone, factoriesBuilder, metaData);
    separator = clone.separator;
    minDepth = clone.minDepth;
    maxDepth = clone.maxDepth;
    keepBlankPath = clone.keepBlankPath;
    depth = clone.depth;
    order = clone.order;
    minDocCount = clone.minDocCount;
    this.bucketCountThresholds = new PathHierarchyAggregator.BucketCountThresholds(clone.bucketCountThresholds);
}
 
Example #11
Source File: MultiValuesSourceAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 5 votes vote down vote up
@Override
protected final MultiValuesSourceAggregatorFactory<VS, ?> doBuild(SearchContext context,
    AggregatorFactory<?> parent,
    AggregatorFactories.Builder subFactoriesBuilder) throws IOException {
  List<NamedValuesSourceConfigSpec<VS>> configs = resolveConfig(context);
  MultiValuesSourceAggregatorFactory<VS, ?> factory = innerBuild(context, configs, parent,
      subFactoriesBuilder);
  return factory;
}
 
Example #12
Source File: DateHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 4 votes vote down vote up
@Override
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) {
    return new DateHierarchyAggregationBuilder(this, factoriesBuilder, metaData);
}
 
Example #13
Source File: PathHierarchyAggregationBuilder.java    From elasticsearch-aggregation-pathhierarchy with MIT License 4 votes vote down vote up
@Override
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metaData) {
    return new PathHierarchyAggregationBuilder(this, factoriesBuilder, metaData);
}
 
Example #14
Source File: MultiValuesSourceAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
protected abstract MultiValuesSourceAggregatorFactory<VS, ?> innerBuild(SearchContext context,
List<NamedValuesSourceConfigSpec<VS>> configs, AggregatorFactory<?> parent,
AggregatorFactories.Builder subFactoriesBuilder) throws IOException;
 
Example #15
Source File: GeoShapeBuilder.java    From elasticsearch-plugin-geoshape with MIT License 4 votes vote down vote up
@Override
protected AggregationBuilder shallowCopy(AggregatorFactories.Builder factoriesBuilder, Map<String, Object> metaData) {
    return new GeoShapeBuilder(this, factoriesBuilder, metaData);
}
 
Example #16
Source File: MultiValuesSourceAggregationBuilder.java    From elasticsearch-linear-regression with Apache License 2.0 4 votes vote down vote up
@Override
public AB subAggregations(Builder subFactories) {
  throw new AggregationInitializationException("Aggregator [" + name + "] of type [" +
      getType() + "] cannot accept sub-aggregations");
}
 
Example #17
Source File: GeoPointClusteringAggregationBuilder.java    From elasticsearch-aggregation-geoclustering with Apache License 2.0 4 votes vote down vote up
@Override
protected AggregationBuilder shallowCopy(Builder factoriesBuilder, Map<String, Object> metaData) {
    return new GeoPointClusteringAggregationBuilder(this, factoriesBuilder, metaData);
}