import * as ast from '../ast' ; import * as literal from '../node_types/literal' ; import { IIndexPattern , KueryNode } from '../../..' ; export function buildNodeParams ( path , child ) { const pathNode = typeof path === 'string' ? ast . fromLiteralExpression ( path ) : literal . buildNode ( path ) ; return { arguments : [ pathNode , child ] , } ; } export function toOpenSearchQuery ( node , indexPattern ? , config = { } , context = { } ) { const [ path , child ] = node . arguments ; const stringPath = ast . toOpenSearchQuery ( path ) ; const fullPath = context ?. nested ?. path ? `${ context . nested . path }.${ stringPath }` : stringPath ; return { nested : { path : fullPath , query : ast . toOpenSearchQuery ( child , indexPattern , config , { ... context , nested : { path : fullPath } , } ) , score_mode : 'none' , } , } ; }