Skip to content

search template mustache loop quoting #19643

@jpcarey

Description

@jpcarey

Elasticsearch version: 2.3.4

JVM version: java version "1.8.0_65", Java(TM) SE Runtime Environment (build 1.8.0_65-b17), Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

OS version: OS X 10.11.5 (15F34)

Description of the problem including expected versus actual behavior: mustache loop inserting extra quotes and commas.

Steps to reproduce:

  1. Use example from https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html#_validating_templates

    GET /_render/template
    {
      "inline": {
        "query": {
          "terms": {
            "status": [
              "{{#status}}",
              "{{.}}",
              "{{/status}}"
            ]
          }
        }
      },
      "params": {
        "status": [ "pending", "published" ]
      }
    }
    
  2. Expected (from the documentation)

    {
      "template_output": {
        "query": {
          "terms": {
            "status": [ 
              "pending",
              "published"
            ]
          }
        }
      }
    }
    
  3. Actual Result

    {
      "template_output": {
        "query": {
          "terms": {
            "status": [
              "",
              "pending",
              "",
              "published",
              ""
            ]
          }
        }
      }
    }
    

Metadata

Metadata

Labels

:Search/SearchSearch-related issues that do not fall into other categories>docsGeneral docs changesdiscuss

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions