Skip to content

Commit

Permalink
[Transform] Fix aggregation name override for the top_metrics aggs (e…
Browse files Browse the repository at this point in the history
…lastic#104446) (elastic#104488)

* [Transform] Fix aggName for the top_metrics agg

* [Transform] update comment

Co-authored-by: Dima Arnautov <[email protected]>
  • Loading branch information
kibanamachine and darnautov authored Jul 6, 2021
1 parent 4ffffd7 commit b85bf3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export function getDefaultAggregationConfig(
case PIVOT_SUPPORTED_AGGS.FILTER:
return getFilterAggConfig(commonConfig);
case PIVOT_SUPPORTED_AGGS.TOP_METRICS:
return getTopMetricsAggConfig(commonConfig);
return getTopMetricsAggConfig({
...commonConfig,
// top_metrics agg has different naming convention by default
aggName: PIVOT_SUPPORTED_AGGS.TOP_METRICS,
});
default:
return commonConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { PivotAggsConfigTopMetrics } from './types';
import { TopMetricsAggForm } from './components/top_metrics_agg_form';
import { isPopulatedObject } from '../../../../../../../../common/shared_imports';
import { PIVOT_SUPPORTED_AGGS } from '../../../../../../../../common/types/pivot_aggs';

/**
* Gets initial basic configuration of the top_metrics aggregation.
Expand All @@ -31,8 +30,6 @@ export function getTopMetricsAggConfig(
isMultiField: true,
field: isPivotAggsConfigWithUiSupport(commonConfig) ? commonConfig.field : '',
AggFormComponent: TopMetricsAggForm,
/** Default name */
aggName: PIVOT_SUPPORTED_AGGS.TOP_METRICS,
aggConfig: {},
getEsAggConfig() {
// ensure the configuration has been completed
Expand Down

0 comments on commit b85bf3c

Please sign in to comment.