# Search templates: partials

**URL:** <https://discuss.elastic.co/t/search-templates-partials/19148>\
**Category:** Elasticsearch\
**Created:** [August 7, 2014, 6:53pm UTC](https://discuss.elastic.co/t/search-templates-partials/19148 "2014-08-07T18:53:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [August 7, 2014, 6:53pm UTC](https://discuss.elastic.co/t/search-templates-partials/19148/1 "2014-08-07T18:53:09Z")

</div>

Developing on v1.2.2, I'm deploying mustache templates by file system under  
config/scripts.

When I do something like this:

parent.mustache

{  
"query": {  
"filtered": {  
"query": {  
"bool": {  
"must": [  
{"match\_all":{}}  
{{#condition}}  
,{"match": {"condition": "{{condition}}"}}  
{{/condition}}  
]  
}  
},  
{{\> child}}  
}  
}  
}

child.mustache

"filter": {  
"bool": {  
"must": [  
{"query": {"match\_all":{}}}  
{{#status}}  
,{  
"query": {  
"match": {  
"status": "{{status}}"  
}  
}  
}  
{{/status}}  
]  
}  
}

I get:  
[2014-08-07 14:48:58,454][WARN][script] [x\_node] failed  
to load/compile script [parent]  
org.elasticsearch.common.mustache.MustacheException: Template 'child' not  
found

I've tried "pathing" in parent ("scripts/child", "config/scripts/child")  
with the same result.

Are partials supported?

--  
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/dbeb9045-c738-4c27-a4df-30f0ad52f019%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dbeb9045-c738-4c27-a4df-30f0ad52f019%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![zdeseb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zdeseb/32/42106_2.png) [@zdeseb](https://discuss.elastic.co/u/zdeseb)\
**Post date:** [March 24, 2015, 4:46pm UTC](https://discuss.elastic.co/t/search-templates-partials/19148/2 "2015-03-24T16:46:44Z")

</div>

I have same troubles now on ES 1.4.4

Did you found solution how to use partials in Mustache file templates?

Thanks,  
Zdenek

Dne čtvrtek 7. srpna 2014 20:53:09 UTC+2 Glen Smith napsal(a):

> Developing on v1.2.2, I'm deploying mustache templates by file system  
> under config/scripts.
> 
> When I do something like this:
> 
> parent.mustache
> 
> {  
> "query": {  
> "filtered": {  
> "query": {  
> "bool": {  
> "must": [  
> {"match\_all":{}}  
> {{#condition}}  
> ,{"match": {"condition": "{{condition}}"}}  
> {{/condition}}  
> ]  
> }  
> },  
> {{\> child}}  
> }  
> }  
> }
> 
> child.mustache
> 
> "filter": {  
> "bool": {  
> "must": [  
> {"query": {"match\_all":{}}}  
> {{#status}}  
> ,{  
> "query": {  
> "match": {  
> "status": "{{status}}"  
> }  
> }  
> }  
> {{/status}}  
> ]  
> }  
> }
> 
> I get:  
> [2014-08-07 14:48:58,454][WARN][script] [x\_node]  
> failed to load/compile script [parent]  
> org.elasticsearch.common.mustache.MustacheException: Template 'child' not  
> found
> 
> I've tried "pathing" in parent ("scripts/child", "config/scripts/child")  
> with the same result.
> 
> Are partials supported?

--  
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/6a4af502-4232-4c6c-98cf-a4c414fea3d1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a4af502-4232-4c6c-98cf-a4c414fea3d1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Glen\_Smith](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glen_smith/32/111656_2.png) [@Glen\_Smith](https://discuss.elastic.co/u/Glen_Smith)\
**Post date:** [March 24, 2015, 5:32pm UTC](https://discuss.elastic.co/t/search-templates-partials/19148/3 "2015-03-24T17:32:02Z")

</div>

Nope. I reached my time limit for trying to get that approach to work and  
finished the job  
using one really big template. It's one more thing on my "things to explore  
again" list.  
I figured, though, that by postponing it, I would at least have the benefit  
of using a later version of ES  
when I got back to it.  
If you're still having issues in 1.4.4, maybe it's time to open an issue.

On Tuesday, March 24, 2015 at 12:46:44 PM UTC-4, Zdeněk Šebl wrote:

> I have same troubles now on ES 1.4.4
> 
> Did you found solution how to use partials in Mustache file templates?
> 
> Thanks,  
> Zdenek
> 
> Dne čtvrtek 7. srpna 2014 20:53:09 UTC+2 Glen Smith napsal(a):
> 
> > Developing on v1.2.2, I'm deploying mustache templates by file system  
> > under config/scripts.
> > 
> > When I do something like this:
> > 
> > parent.mustache
> > 
> > {  
> > "query": {  
> > "filtered": {  
> > "query": {  
> > "bool": {  
> > "must": [  
> > {"match\_all":{}}  
> > {{#condition}}  
> > ,{"match": {"condition": "{{condition}}"}}  
> > {{/condition}}  
> > ]  
> > }  
> > },  
> > {{\> child}}  
> > }  
> > }  
> > }
> > 
> > child.mustache
> > 
> > "filter": {  
> > "bool": {  
> > "must": [  
> > {"query": {"match\_all":{}}}  
> > {{#status}}  
> > ,{  
> > "query": {  
> > "match": {  
> > "status": "{{status}}"  
> > }  
> > }  
> > }  
> > {{/status}}  
> > ]  
> > }  
> > }
> > 
> > I get:  
> > [2014-08-07 14:48:58,454][WARN][script] [x\_node]  
> > failed to load/compile script [parent]  
> > org.elasticsearch.common.mustache.MustacheException: Template 'child' not  
> > found
> > 
> > I've tried "pathing" in parent ("scripts/child", "config/scripts/child")  
> > with the same result.
> > 
> > Are partials supported?

--  
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/dca89f6c-ca6b-4f2f-8842-708fe822d014%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dca89f6c-ca6b-4f2f-8842-708fe822d014%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![zdeseb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zdeseb/32/42106_2.png) [@zdeseb](https://discuss.elastic.co/u/zdeseb)\
**Post date:** [March 24, 2015, 6:53pm UTC](https://discuss.elastic.co/t/search-templates-partials/19148/4 "2015-03-24T18:53:10Z")

</div>

Thanks for info. I am going to open new issue.

--  
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/338d2bb4-7bf2-4794-abc1-c6aa4a40ad55%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/338d2bb4-7bf2-4794-abc1-c6aa4a40ad55%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, 12:24am UTC](https://discuss.elastic.co/t/search-templates-partials/19148/5 "2017-07-06T00:24:18Z")

</div>


