# Template \_search unexpected character

**URL:** <https://discuss.elastic.co/t/template-search-unexpected-character/150754>\
**Category:** Elasticsearch\
**Created:** [October 2, 2018, 7:21pm UTC](https://discuss.elastic.co/t/template-search-unexpected-character/150754 "2018-10-02T19:21:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackFazackerley](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@JackFazackerley](https://discuss.elastic.co/u/JackFazackerley)\
**Post date:** [October 2, 2018, 7:21pm UTC](https://discuss.elastic.co/t/template-search-unexpected-character/150754/1 "2018-10-02T19:21:58Z")

</div>

Elasticsearch version: 6.3.2

I have a search template, which I am using to loop over an array of strings but when I `_search/template` I get an error saying `Unexpected character ('{' (code 123)): was expecting comma to separate Array entries`. However if I `_render/template` then copy it and just use `_search` it works perfectly.

Template:

```auto
{
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "must_not": [
              {{#keywords}}
              {
                "term": {
                  "title": "{{.}}"
                }
              },
              {
                "term": {
                  "categories.name.raw": "{{.}}"
                }
              }
              {{/keywords}}
            ],
            "minimum_should_match": "1",
            "boost": 0.2
          }
        }
      ]
    }
  },
  "size": 0
}

```

Params:

```auto
{
  "id": "products_test",
  "params": {
    "params": [
      "book",
      "cover"
    ]
  }
}

```

\_render result:

```auto
{
  "template_output": {
    "query": {
      "bool": {
        "filter": [
          {
            "bool": {
              "must_not": [
                {
                  "term": {
                    "title": "book"
                  }
                },
                {
                  "term": {
                    "categories.name.raw": "book"
                  }
                },
                {
                  "term": {
                    "title": "cover"
                  }
                },
                {
                  "term": {
                    "categories.name.raw": "cover"
                  }
                }
              ],
              "minimum_should_match": "1",
              "boost": 0.2
            }
          }
        ]
      }
    },
    "size": 0
  }
}

```

I can't see anything I'm doing wrong but I might have missed something.

---

<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, 2018, 7:22pm UTC](https://discuss.elastic.co/t/template-search-unexpected-character/150754/2 "2018-10-30T19:22:08Z")

</div>

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