import { Vis } from '../../../visualizations/public' ; import { buildExpression , buildExpressionFunction } from '../../../expressions/public' ; import { EsaggsExpressionFunctionDefinition , IndexPatternLoadExpressionFunctionDefinition , } from '../../../data/public' ; param vis export function getEsaggsFn < T > ( vis ) { return buildExpressionFunction < EsaggsExpressionFunctionDefinition > ( 'esaggs' , { index : buildExpression ( [ buildExpressionFunction < IndexPatternLoadExpressionFunctionDefinition > ( 'indexPatternLoad' , { id : vis . data . indexPattern ! . id ! , } ) , ] ) , metricsAtAllLevels : vis . isHierarchical ( ) , partialRows : false , aggs : vis . data . aggs ! . aggs . map ( ( agg ) => buildExpression ( agg . toExpressionAst ( ) ) ) , } ) ; }