Pass array to search template

I have a search template and now I need to pass some parameters. Strings are no problem, but how do I pass an array?

In the documentation I found that I need to use {{#toJson}}. But this seems not to work.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html#search-template-converting-to-json

Search template:
"filter": [
{
"terms": "{{#toJson}}types{{/toJson}}"
},

Parameter:
"types": {
"type": ["type1","type2","type3"]
}

Anybody has a solution for passing an array to the search template ?

1 Like

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