import { Filter , FilterMeta } from './meta_filter' ; import { IIndexPattern , IFieldType } from '../../index_patterns' ; export type ExistsFilterMeta = FilterMeta ; export interface FilterExistsProperty { field : any ; } export type ExistsFilter = Filter & { meta : ExistsFilterMeta ; exists ? : FilterExistsProperty ; } ; export const isExistsFilter = ( filter ) : filter is ExistsFilter => filter && filter . exists ; export const getExistsFilterField = ( filter ) => { return filter . exists && filter . exists . field ; } ; export const buildExistsFilter = ( field , indexPattern ) => { return { meta : { index : indexPattern . id , } , exists : { field : field . name , } , } as ExistsFilter ; } ;