import { cloneDeep } from 'lodash' ; import { OBSERVER_VERSION_MAJOR } from '../../../../../common/elasticsearch_fieldnames' ; import { ESSearchRequest , ESFilter , } from '../../../../../../../../src/core/types/elasticsearch' ; export function addFilterToExcludeLegacyData ( params ) { const nextParams = cloneDeep ( params ) ; nextParams . body . query . bool . filter . push ( { range : { [ OBSERVER_VERSION_MAJOR ] : { gte : 7 } } , } ) ; return nextParams ; }