import { overwrite } from '../../helpers' ; import type { TableRequestProcessorsFunction } from './types' ; export const splitByTerms = ( { panel } ) => { return ( next ) => ( doc ) => { panel . series . filter ( ( c ) => c . aggregate_by && c . aggregate_function ) . forEach ( ( column ) => { overwrite ( doc , `aggs.pivot.aggs.${ column . id }.terms.field` , column . aggregate_by ) ; overwrite ( doc , `aggs.pivot.aggs.${ column . id }.terms.size` , 100 ) ; } ) ; return next ( doc ) ; } ; } ;