Basic Elastic Search Query

can i add variable & inject this script inside it ?

I have tried to do that by several syntaxes… with no luck

I got this error:
Template variables could not be initialized: a.metricFindQuery(...) is undefined