# Search template - how to pass array of values as parameter

**URL:** <https://discuss.elastic.co/t/search-template-how-to-pass-array-of-values-as-parameter/285756>\
**Category:** Elasticsearch\
**Created:** [October 2, 2021, 8:16pm UTC](https://discuss.elastic.co/t/search-template-how-to-pass-array-of-values-as-parameter/285756 "2021-10-02T20:16:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![askids](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/askids/32/22252_2.png) [@askids](https://discuss.elastic.co/u/askids)\
**Post date:** [October 2, 2021, 8:16pm UTC](https://discuss.elastic.co/t/search-template-how-to-pass-array-of-values-as-parameter/285756/1 "2021-10-02T20:16:03Z")

</div>

hi,

I am trying to convert an existing query using term\_set to a search template. But I am unable to find any documentation that shows how to pass array value as parameter input. There is sample for passing json array to terms. But when using term\_set, the field name is already mentioned. So only array values are being passed to terms.

Below is the part of the query that I am trying to convert. I want to pass the values to terms as parameter to template. Can anyone please suggest how this can be achieved?

```auto
{
  "term_set" : {
    "myfieldname" : {
      "boost" : 100,
      "terms" : ["001", "002"],
      "minimum_should_match" : "required_matchcount_fieldname"
    }
  }
}

```

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:** [October 30, 2021, 8:16pm UTC](https://discuss.elastic.co/t/search-template-how-to-pass-array-of-values-as-parameter/285756/2 "2021-10-30T20:16:52Z")

</div>

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