export function buildBaseFilterCriteria ( timeFieldName ? , earliestMs ? , latestMs ? , query ? ) { const filterCriteria = [ ] ; if ( timeFieldName && earliestMs && latestMs ) { filterCriteria . push ( { range : { [ timeFieldName ] : { gte : earliestMs , lte : latestMs , format : 'epoch_millis' , } , } , } ) ; } if ( query ) { filterCriteria . push ( query ) ; } return filterCriteria ; }