import { get } from 'lodash' ; import { IBucketAggConfig } from '../bucket_agg_type' ; import { buildQueryFilter } from '../../../../../common' ; export const createFilterFilters = ( aggConfig , key ) => { const dslFilters = get ( aggConfig . toDsl ( ) , 'filters.filters' ) ; const filter = dslFilters [ key ] ; const indexPattern = aggConfig . getIndexPattern ( ) ; if ( filter && indexPattern && indexPattern . id ) { return buildQueryFilter ( filter , indexPattern . id , key ) ; } } ;