# Templated search with a array of complex objects

**URL:** <https://discuss.elastic.co/t/templated-search-with-a-array-of-complex-objects/21965>\
**Category:** Elasticsearch\
**Created:** [February 3, 2015, 10:50pm UTC](https://discuss.elastic.co/t/templated-search-with-a-array-of-complex-objects/21965 "2015-02-03T22:50:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keith\_Stenson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/keith_stenson/32/938_2.png) [@Keith\_Stenson](https://discuss.elastic.co/u/Keith_Stenson)\
**Post date:** [February 3, 2015, 10:50pm UTC](https://discuss.elastic.co/t/templated-search-with-a-array-of-complex-objects/21965/1 "2015-02-03T22:50:38Z")

</div>

Hi Guys,

I'm having a issue getting a templated search to work, I want to be able to  
add new term filters to the query based on a array that is generated from a  
UI.

{  
"template":{  
"filter":{  
"bool":{  
"must":[  
"{{#features}}",  
{  
"term":{  
"{{field}}":"{{value}}"  
}  
},  
"{{/features}}"  
]  
}  
}  
},  
"params":{  
"features":[  
{  
"field":"services.TV.features.HD",  
"value":true  
},  
{  
"field":"services.TV.features.3D",  
"value":true  
}  
]  
}  
}

This seems to get it really close to the query i'm looking for expect it's  
fail because of the added double quotes shown in the error message below:

Error:  
Parse Failure[  
Failed to parse source[  
{  
"filter":{

```
  "bool":{

     "must":[

        "",

        {

           "term":{

              "services.TV.features.HD":"true"

           }

        },

        "",

        {

           "term":{

              "services.TV.features.3D":"true"

           }

        },

        ""

     ]

  }

```

}

}

Can anyone offer suggestions.

Regards,

Keith

--  
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/e715bd85-0677-4f49-872e-481851d7004e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e715bd85-0677-4f49-872e-481851d7004e%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:35am UTC](https://discuss.elastic.co/t/templated-search-with-a-array-of-complex-objects/21965/2 "2017-07-06T00:35:06Z")

</div>


