import { extend , defaults } from 'lodash' ; import { getTimeZoneFromSettings } from '../utils' ; import { DslQuery , isOpenSearchQueryString } from './opensearch_query_dsl' ; param query param queryStringOptions param dateFormatTZ returns { object } export function decorateQuery ( query , queryStringOptions , dateFormatTZ ? ) { if ( isOpenSearchQueryString ( query ) ) { extend ( query . query_string , queryStringOptions ) ; if ( dateFormatTZ ) { defaults ( query . query_string , { time_zone : getTimeZoneFromSettings ( dateFormatTZ ) , } ) ; } } return query ; }