Skip to content

Commit ad91ba7

Browse files
darnautovpeteharverson
authored andcommitted
[ML] do not throw an error when agg is not supported by UI (#72685)
1 parent 2eca36f commit ad91ba7

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

x-pack/plugins/transform/public/app/common/pivot_aggs.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import {
1111
} from '../sections/create_transform/components/step_define/common/filter_agg/components';
1212

1313
describe('getAggConfigFromEsAgg', () => {
14-
test('should throw an error for unsupported agg', () => {
15-
expect(() => getAggConfigFromEsAgg({ terms: {} }, 'test')).toThrowError();
16-
});
17-
1814
test('should return a common config if the agg does not have a custom config defined', () => {
1915
expect(getAggConfigFromEsAgg({ avg: { field: 'region' } }, 'test_1')).toEqual({
2016
agg: 'avg',

x-pack/plugins/transform/public/app/common/pivot_aggs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ export function getAggConfigFromEsAgg(
110110
// Find the main aggregation key
111111
const agg = aggKeys.find((aggKey) => aggKey !== 'aggs');
112112

113-
if (!isPivotSupportedAggs(agg)) {
114-
throw new Error(`Aggregation "${agg}" is not supported`);
113+
if (agg === undefined) {
114+
throw new Error(`Aggregation key is required`);
115115
}
116116

117117
const commonConfig: PivotAggsConfigBase = {

0 commit comments

Comments
 (0)