mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(elasticsearch): added geo hash bucket aggregation
This commit is contained in:
@@ -60,6 +60,10 @@ function (angular, _, queryDef) {
|
||||
$scope.agg.query = '*';
|
||||
break;
|
||||
}
|
||||
case 'geohash_grid': {
|
||||
$scope.agg.settings.precision = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.validateModel();
|
||||
@@ -121,6 +125,13 @@ function (angular, _, queryDef) {
|
||||
if (settings.trimEdges && settings.trimEdges > 0) {
|
||||
settingsLinkText += ', Trim edges: ' + settings.trimEdges;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'geohash_grid': {
|
||||
// limit precision to 7
|
||||
settings.precision = Math.max(Math.min(settings.precision, 7), 1);
|
||||
settingsLinkText = 'Precision: ' + settings.precision;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="agg.type === 'geohash_grid'">
|
||||
<div class="gf-form offset-width-7">
|
||||
<label class="gf-form-label">Precision</label>
|
||||
<input type="number" class="gf-form-input max-width-12" ng-model="agg.settings.precision" spellcheck='false' placeholder="3" ng-blur="onChangeInternal()">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -153,6 +153,10 @@ function (queryDef) {
|
||||
this.buildTermsAgg(aggDef, esAgg, target);
|
||||
break;
|
||||
}
|
||||
case 'geohash_grid': {
|
||||
esAgg['geohash_grid'] = {field: aggDef.field, precision: aggDef.settings.precision};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
nestedAggs.aggs = nestedAggs.aggs || {};
|
||||
|
||||
@@ -22,6 +22,7 @@ function (_) {
|
||||
bucketAggTypes: [
|
||||
{text: "Terms", value: 'terms', requiresField: true},
|
||||
{text: "Filters", value: 'filters' },
|
||||
{text: "Geo Hash Grid", value: 'geohash_grid', requiresField: true},
|
||||
{text: "Date Histogram", value: 'date_histogram', requiresField: true},
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user