mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Elasticsearch: Add Moving Function Pipeline Aggregation (#28131)
* Elasticsearch: Add Moving Function Pipeline Aggregation * Removing support for moving average in 7.x * Fixing getMetricAggTypes to handle undefined esVersion * Adding moving_fn to go code * Update public/app/plugins/datasource/elasticsearch/metric_agg.ts Co-authored-by: Giordano Ricci <grdnricci@gmail.com> * Adding test for esversion 70 * Removing default value for script, adding placeholder instead * Fixing formatting * Adding code for handling missing or obsolete aggregations Co-authored-by: Giordano Ricci <grdnricci@gmail.com>
This commit is contained in:
@@ -162,8 +162,21 @@ describe('ElasticQueryDef', () => {
|
||||
});
|
||||
|
||||
describe('using esversion 5', () => {
|
||||
const metricAggTypes = queryDef.getMetricAggTypes(5);
|
||||
test('should get pipeline aggs', () => {
|
||||
expect(queryDef.getMetricAggTypes(5).length).toBe(15);
|
||||
expect(metricAggTypes.length).toBe(15);
|
||||
});
|
||||
});
|
||||
describe('using esversion 70', () => {
|
||||
const metricAggTypes = queryDef.getMetricAggTypes(70);
|
||||
test('should get pipeline aggs', () => {
|
||||
expect(metricAggTypes.length).toBe(15);
|
||||
});
|
||||
test('should get pipeline aggs with moving function', () => {
|
||||
expect(metricAggTypes.some(m => m.value === 'moving_fn')).toBeTruthy();
|
||||
});
|
||||
test('should get pipeline aggs without moving average', () => {
|
||||
expect(metricAggTypes.some(m => m.value === 'moving_avg')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user