import { has } from 'lodash' ; export interface DslRangeQuery { range : { [ name ] : { gte : number ; lte : number ; format : string ; } ; } ; } export interface DslMatchQuery { match : { [ name ] : { query : string ; operator : string ; zero_terms_query : string ; } ; } ; } export interface DslQueryStringQuery { query_string : { query : string ; analyze_wildcard ? : boolean ; } ; } export interface DslMatchAllQuery { match_all : Record < string , string > ; } export interface DslTermQuery { term : Record < string , string > ; } export type DslQuery = DslRangeQuery | DslMatchQuery | DslQueryStringQuery | DslMatchAllQuery | DslTermQuery ; export const isOpenSearchQueryString = ( query ) : query is DslQueryStringQuery => has ( query , 'query_string.query' ) ;