# Template within a template

**URL:** <https://discuss.elastic.co/t/template-within-a-template/144773>\
**Category:** Elasticsearch\
**Created:** [August 16, 2018, 7:12pm UTC](https://discuss.elastic.co/t/template-within-a-template/144773 "2018-08-16T19:12:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kfarbman](https://avatars.discourse-cdn.com/v4/letter/k/b487fb/32.png) [@kfarbman](https://discuss.elastic.co/u/kfarbman)\
**Post date:** [August 16, 2018, 7:12pm UTC](https://discuss.elastic.co/t/template-within-a-template/144773/1 "2018-08-16T19:12:45Z")

</div>

Is there any way to call a template within a template. For example, in python, I have 3 functions that create JSON of queries that I call to combine into a bigger template to query.

So I have (basically):

match = {query: {bool: {should: [match\_1, match\_2, match\_3]}}}

I want to be able to create an elasticsearch template for match that calls templates for match\_1, match\_2, and match\_3 instead of having to hardcode those queries into one template.

Thanks!

---

<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:** [September 13, 2018, 7:12pm UTC](https://discuss.elastic.co/t/template-within-a-template/144773/2 "2018-09-13T19:12:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
