# Object interpolation in template queries

**URL:** <https://discuss.elastic.co/t/object-interpolation-in-template-queries/17574>\
**Category:** Elasticsearch\
**Created:** [May 18, 2014, 12:49am UTC](https://discuss.elastic.co/t/object-interpolation-in-template-queries/17574 "2014-05-18T00:49:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_G](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Alex\_G](https://discuss.elastic.co/u/Alex_G)\
**Post date:** [May 18, 2014, 12:49am UTC](https://discuss.elastic.co/t/object-interpolation-in-template-queries/17574/1 "2014-05-18T00:49:39Z")

</div>

Hello,

I'm interested in using query templates -  
[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-template-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-template-query.html)

- however for my purposes I was hoping ES treaded queries as simple strings  
for the purpose of mustache interpretation and I would to be able to  
substitute in parameters more complex than partial strings - for example to  
define a param as the contents of a value and then pass in an arbitrary  
object.

IE something along the lines of  
{  
"query": {  
"template": {  
"query": {  
"filtered": {  
"filter" : {  
"and" : {{ filters }}  
}  
}  
},  
"params" : {  
"filters" : [  
{"terms" : { "foo" : ["a","b"] } },  
{"terms" : { "bar" : ["q","z"] } }  
]  
}  
}  
}  
}

Experimentation suggests this isn't supported but I understand that the  
query templates system is somewhat under construction or review - are there  
plans to offer support for passing in entire parts of queries via params or  
should I look at doing this kind of interpolation before the query gets to  
ES? Or is this possible and I'm simply doing it wrong?

Thanks,  
Alex

--

* * *

_CONFIDENTIALITY NOTICE:_ The information contained in this message may be privileged and/or confidential. It is the property of CrowdStrike. If you are not the intended recipient, or responsible for delivering this message to the intended recipient, any review, forwarding, dissemination, distribution or copying of this communication or any attachment(s) is strictly prohibited. If you have received this message in error, please notify the sender immediately, and delete it and all attachments from your computer and network.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/8b83afe9-aa92-4751-8178-2c33bbc94428%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/8b83afe9-aa92-4751-8178-2c33bbc94428%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:28am UTC](https://discuss.elastic.co/t/object-interpolation-in-template-queries/17574/2 "2017-07-06T01:28:40Z")

</div>


