# Template Query - issues passing a non-string argument

**URL:** <https://discuss.elastic.co/t/template-query-issues-passing-a-non-string-argument/48834>\
**Category:** Elasticsearch\
**Created:** [April 29, 2016, 6:12pm UTC](https://discuss.elastic.co/t/template-query-issues-passing-a-non-string-argument/48834 "2016-04-29T18:12:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aumapathy](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@aumapathy](https://discuss.elastic.co/u/aumapathy)\
**Post date:** [April 29, 2016, 6:12pm UTC](https://discuss.elastic.co/t/template-query-issues-passing-a-non-string-argument/48834/1 "2016-04-29T18:12:00Z")

</div>

I have a requirement where I need to pass in an entire query as an argument to the query template.I could find examples for passing in an array and not an entire query. I used sense to see if it was possible to achieve this with a simple match query and I am running into exceptions of these forms  
{  
"type": "json\_parse\_exception",  
"reason": "Unexpected character ('=' (code 61)): was expecting a colon to separate field name and value\n at [Source: [B@379f4a3e; line: 1, column: 17]"  
}

I created the template in the following way  
PUT /\_search/template/my\_template  
{  
"template" :"{"query":{{query\_string}}}"  
}

I used the following to see how it will be rendered by ES  
GET \_render/template?  
{  
"id" : "my\_template",  
"params" :{  
"query\_string" : {"match":{"hello":"TEXT"}}  
}  
}

I even tried storing the template in the config/script directory and I ran into the same issue.

Any help is appreciated !

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/template-query-issues-passing-a-non-string-argument/48834/2 "2017-07-05T22:55:11Z")

</div>


