Commit 98254841 by Mattia Rossi

Add support for Offset in elasticsearch datasource, date_histogram aggregation,…

Add support for Offset in elasticsearch datasource, date_histogram aggregation, fixes grafana #12653
parent efcbb92b
...@@ -70,6 +70,16 @@ ...@@ -70,6 +70,16 @@
</label> </label>
<input class="gf-form-input max-width-12" type="number" ng-model="agg.settings.trimEdges" ng-change="onChangeInternal()"> <input class="gf-form-input max-width-12" type="number" ng-model="agg.settings.trimEdges" ng-change="onChangeInternal()">
</div> </div>
<div class="gf-form offset-width-7">
<label class="gf-form-label width-10">
Offset
<info-popover mode="right-normal">
Interval Offset
</info-popover>
</label>
<input class="gf-form-input max-width-12" type="text" ng-model="agg.settings.offset" ng-change="onChangeInternal()">
</div>
</div> </div>
<div ng-if="agg.type === 'histogram'"> <div ng-if="agg.type === 'histogram'">
......
...@@ -71,6 +71,7 @@ export class ElasticQueryBuilder { ...@@ -71,6 +71,7 @@ export class ElasticQueryBuilder {
esAgg.min_doc_count = settings.min_doc_count || 0; esAgg.min_doc_count = settings.min_doc_count || 0;
esAgg.extended_bounds = { min: '$timeFrom', max: '$timeTo' }; esAgg.extended_bounds = { min: '$timeFrom', max: '$timeTo' };
esAgg.format = 'epoch_millis'; esAgg.format = 'epoch_millis';
esAgg.offset = settings.offset || '0';
if (esAgg.interval === 'auto') { if (esAgg.interval === 'auto') {
esAgg.interval = '$__interval'; esAgg.interval = '$__interval';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment