anchor.diff:            }
           ]
         }
  +    }
  +}
  +------------------------------------------
  +
  +
  +[float]
  +===== Concatenating array of values
  +
  +The `{{#join}}array{{/join}}` function can be used to concatenate the
  +values of an array as a comma delimited string:
  +
  +[source,js]
  +------------------------------------------
  +GET /_search/template
  +{
  +  "inline": {
  +    "query": {
  +      "match": {
  +        "emails": "{{#join}}emails{{/join}}"
  +      }
  +    }
  +  },
  +  "params": {
  +    "emails": [ "username@email.com", "lastname@email.com" ]
  +  }
  +}
  +------------------------------------------
  +
  +which is rendered as:
  +
  +[source,js]
  +------------------------------------------
  +{
  +    "query" : {
  +        "match" : {
  +            "emails" : "username@email.com,lastname@email.com"
  +        }
  +    }
  +}
  +------------------------------------------
  +
  +The function also accepts a custom delimiter:
  +
  +[source,js]
  +------------------------------------------
  +GET /_search/template
  +{
  +  "inline": {
  +    "query": {
  +      "range": {
  +        "born": {
  +            "gte"   : "{{date.min}}",
  +            "lte"   : "{{date.max}}",
  +            "format": "{{#join delimiter='||'}}date.formats{{/join delimiter='||'}}"
  +	    }
  +      }
  +    }
  +  },
  +  "params": {
  +    "date": {
  +        "min": "2016",
  +        "max": "31/12/2017",
  +        "formats": ["dd/MM/yyyy", "yyyy"]
  +    }
  +  }
  +}
  +------------------------------------------
  +
  +which is rendered as:
  +
  +[source,js]
  +------------------------------------------
  +{
  +    "query" : {
  +      "range" : {
  +        "born" : {
  +          "gte" : "2016",
  +          "lte" : "31/12/2017",
  +          "format" : "dd/MM/yyyy||yyyy"
  +        }
  +      }
  +    }
  +}
  +
  +------------------------------------------
  +
  +
  +[float]
  +===== Default values
  +
  +A default value is written as `{{var}}{{^var}}default{{/var}}` for instance:
  +
  +[source,js]
  +------------------------------------------
  +{
  +  "inline": {
  +    "query": {
  +      "range": {
  +        "line_no": {
  +          "gte": "{{start}}",
  +          "lte": "{{end}}{{^end}}20{{/end}}"
  +        }
  +      }
  +    }
  +  },
  +  "params": { ... }
  +}
  +------------------------------------------
  +
  +When `params` is `{ "start": 10, "end": 15 }` this query would be rendered as:
  +
  +[source,js]
  +------------------------------------------
  +{
  +    "range": {
  +        "line_no": {
  +            "gte": "10",
  +            "lte": "15"
  +        }
  +  }
  +}
  +------------------------------------------
  +
  +But when `params` is `{ "start": 10 }` this query would use the default value
  +for `end`:
  +
  +[source,js]
  +------------------------------------------
  +{
  +    "range": {
  +        "line_no": {
  +            "gte": "10",
  +            "lte": "20"
  +        }
       }
   }
   ------------------------------------------
  
positive.code: ------------------------------------------
  
  [float]
  ===== Passing an array of strings
  
  [source,js]
  ------------------------------------------
  GET /_search/template
  {
    "inline": {
      "query": {
        "terms": {
          "status": [
            "{{#status}}",
            "{{.}}",
            "{{/status}}"
          ]
        }
      }
    },
    "params": {
      "status": [ "pending", "published" ]
    }
  
negative.code: ==================================
  As written above, this template is not valid JSON because it includes the
  _section_ markers like `{{#line_no}}`.  For this reason, the template should
  either be stored in a file (see <<pre-registered-templates>>) or, when used
  via the REST API, should be written as a string:
  
  [source,js]
  