Search in sources :

Example 1 with Builder

use of org.opensearch.search.aggregations.AggregatorFactories.Builder in project OpenSearch by opensearch-project.

the class AggregatorFactoriesBuilderTests method doParseInstance.

@Override
protected Builder doParseInstance(XContentParser parser) throws IOException {
    // parseAggregators expects to be already inside the xcontent object
    assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
    AggregatorFactories.Builder builder = AggregatorFactories.parseAggregators(parser);
    return builder;
}
Also used : Builder(org.opensearch.search.aggregations.AggregatorFactories.Builder)

Example 2 with Builder

use of org.opensearch.search.aggregations.AggregatorFactories.Builder in project OpenSearch by opensearch-project.

the class AggregatorFactoriesBuilderTests method createTestInstance.

@Override
protected Builder createTestInstance() {
    AggregatorFactories.Builder builder = new AggregatorFactories.Builder();
    // ensure that the unlikely does not happen: 2 aggs share the same name
    Set<String> names = new HashSet<>();
    for (int i = 0; i < randomIntBetween(1, 20); ++i) {
        AggregationBuilder aggBuilder = getRandomAggregation();
        if (names.add(aggBuilder.getName())) {
            builder.addAggregator(aggBuilder);
        }
    }
    for (int i = 0; i < randomIntBetween(0, 20); ++i) {
        PipelineAggregationBuilder aggBuilder = getRandomPipelineAggregation();
        if (names.add(aggBuilder.getName())) {
            builder.addPipelineAggregator(aggBuilder);
        }
    }
    return builder;
}
Also used : CumulativeSumPipelineAggregationBuilder(org.opensearch.search.aggregations.pipeline.CumulativeSumPipelineAggregationBuilder) CumulativeSumPipelineAggregationBuilder(org.opensearch.search.aggregations.pipeline.CumulativeSumPipelineAggregationBuilder) Builder(org.opensearch.search.aggregations.AggregatorFactories.Builder) Builder(org.opensearch.search.aggregations.AggregatorFactories.Builder) CumulativeSumPipelineAggregationBuilder(org.opensearch.search.aggregations.pipeline.CumulativeSumPipelineAggregationBuilder) HashSet(java.util.HashSet)

Aggregations

Builder (org.opensearch.search.aggregations.AggregatorFactories.Builder)2 HashSet (java.util.HashSet)1 CumulativeSumPipelineAggregationBuilder (org.opensearch.search.aggregations.pipeline.CumulativeSumPipelineAggregationBuilder)1