use of org.graylog.shaded.elasticsearch7.org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval in project graylog2-server by Graylog2.
the class ESTimeHandler method doCreateAggregation.
@Nonnull
@Override
public Optional<AggregationBuilder> doCreateAggregation(String name, Pivot pivot, Time timeSpec, ESPivot searchTypeHandler, ESGeneratedQueryContext esGeneratedQueryContext, Query query) {
final DateHistogramInterval dateHistogramInterval = new DateHistogramInterval(timeSpec.interval().toDateInterval(query.effectiveTimeRange(pivot)).toString());
final Optional<BucketOrder> ordering = orderForPivot(pivot, timeSpec, esGeneratedQueryContext);
final DateHistogramAggregationBuilder builder = AggregationBuilders.dateHistogram(name).field(timeSpec.field()).order(ordering.orElse(BucketOrder.key(true))).format("date_time");
setInterval(builder, dateHistogramInterval);
record(esGeneratedQueryContext, pivot, timeSpec, name, ParsedDateHistogram.class);
return Optional.of(builder);
}
Aggregations