use of org.graylog.storage.elasticsearch7.views.searchtypes.pivot.ESPivotSeriesSpecHandler in project graylog2-server by Graylog2.
the class ElasticsearchBackendGeneratedRequestTestBase method setUpSUT.
@Before
public void setUpSUT() {
this.elasticSearchTypeHandlers = new HashMap<>();
final Map<String, ESPivotBucketSpecHandler<? extends BucketSpec, ? extends Aggregation>> bucketHandlers = Collections.emptyMap();
final Map<String, ESPivotSeriesSpecHandler<? extends SeriesSpec, ? extends Aggregation>> seriesHandlers = new HashMap<>();
seriesHandlers.put(Average.NAME, new ESAverageHandler());
seriesHandlers.put(Max.NAME, new ESMaxHandler());
elasticSearchTypeHandlers.put(Pivot.NAME, () -> new ESPivot(bucketHandlers, seriesHandlers));
this.elasticsearchBackend = new ElasticsearchBackend(elasticSearchTypeHandlers, jestClient, indexLookup, new QueryStringDecorators.Fake(), (elasticsearchBackend, ssb, job, query) -> new ESGeneratedQueryContext(elasticsearchBackend, ssb, job, query, fieldTypesLookup), false, objectMapper);
}
use of org.graylog.storage.elasticsearch7.views.searchtypes.pivot.ESPivotSeriesSpecHandler in project graylog2-server by Graylog2.
the class ESPivot method processSeries.
private void processSeries(PivotResult.Row.Builder rowBuilder, SearchResponse searchResult, ESGeneratedQueryContext queryContext, Pivot pivot, ArrayDeque<String> columnKeys, HasAggregations aggregation, boolean rollup, String source) {
pivot.series().forEach(seriesSpec -> {
final ESPivotSeriesSpecHandler<? extends SeriesSpec, ? extends Aggregation> seriesHandler = seriesHandlers.get(seriesSpec.type());
final Aggregation series = seriesHandler.extractAggregationFromResult(pivot, seriesSpec, aggregation, queryContext);
seriesHandler.handleResult(pivot, seriesSpec, searchResult, series, this, queryContext).map(value -> {
columnKeys.addLast(value.id());
final PivotResult.Value v = PivotResult.Value.create(columnKeys, value.value(), rollup, source);
columnKeys.removeLast();
return v;
}).forEach(rowBuilder::addValue);
});
}
use of org.graylog.storage.elasticsearch7.views.searchtypes.pivot.ESPivotSeriesSpecHandler in project graylog2-server by Graylog2.
the class ElasticsearchBackendGeneratedRequestTestBase method setUpSUT.
@Before
public void setUpSUT() {
this.elasticSearchTypeHandlers = new HashMap<>();
final Map<String, ESPivotBucketSpecHandler<? extends BucketSpec, ? extends Aggregation>> bucketHandlers = Collections.emptyMap();
final Map<String, ESPivotSeriesSpecHandler<? extends SeriesSpec, ? extends Aggregation>> seriesHandlers = new HashMap<>();
seriesHandlers.put(Average.NAME, new ESAverageHandler());
seriesHandlers.put(Max.NAME, new ESMaxHandler());
elasticSearchTypeHandlers.put(Pivot.NAME, () -> new ESPivot(bucketHandlers, seriesHandlers));
this.elasticsearchBackend = new ElasticsearchBackend(elasticSearchTypeHandlers, client, indexLookup, new QueryStringDecorators.Fake(), (elasticsearchBackend, ssb, job, query) -> new ESGeneratedQueryContext(elasticsearchBackend, ssb, job, query, fieldTypesLookup), false);
}
Aggregations