Search in sources :

Example 6 with Min

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Min in project graylog2-server by Graylog2.

the class ESPivotTest method createTimestampRangeAggregations.

private Aggregations createTimestampRangeAggregations(Double min, Double max) {
    final Min timestampMinAggregation = mock(Min.class);
    when(timestampMinAggregation.getValue()).thenReturn(min);
    when(timestampMinAggregation.getName()).thenReturn("timestamp-min");
    final Max timestampMaxAggregation = mock(Max.class);
    when(timestampMaxAggregation.getValue()).thenReturn(max);
    when(timestampMaxAggregation.getName()).thenReturn("timestamp-max");
    return new Aggregations(ImmutableList.of(timestampMinAggregation, timestampMaxAggregation));
}
Also used : Min(org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Min) Max(org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Max) Aggregations(org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.Aggregations)

Example 7 with Min

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Min in project graylog2-server by Graylog2.

the class ESMinHandler method doCreateAggregation.

@Nonnull
@Override
public Optional<AggregationBuilder> doCreateAggregation(String name, Pivot pivot, Min minSpec, ESPivot searchTypeHandler, ESGeneratedQueryContext queryContext) {
    final MinAggregationBuilder min = AggregationBuilders.min(name).field(minSpec.field());
    record(queryContext, pivot, minSpec, name, org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Min.class);
    return Optional.of(min);
}
Also used : MinAggregationBuilder(org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.MinAggregationBuilder) Nonnull(javax.annotation.Nonnull)

Aggregations

Max (org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Max)3 Min (org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.Min)3 MinAggregationBuilder (org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.metrics.MinAggregationBuilder)2 SearchSourceBuilder (org.graylog.shaded.elasticsearch7.org.elasticsearch.search.builder.SearchSourceBuilder)2 Resources (com.google.common.io.Resources)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 UncheckedIOException (java.io.UncheckedIOException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 Files (java.nio.file.Files)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Nonnull (javax.annotation.Nonnull)1 SearchRequest (org.elasticsearch.action.search.SearchRequest)1 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)1