Extra quotes in template query rendering


(Ghasem) #1

i used a template query like below

GET /_search/template { "inline": { "size": 20, "explain": false, "query": { "bool": { "should": [ "{{#my_field}}", { "dis_max": { "tie_breaker": 0, "queries": [ { "multi_match": { "query": "{{my_value}}", "fields": "{{.}}_*_value^100", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } }, { "multi_match": { "query": "{{my_value}}", "fields": "{{.}}_*_value^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 2 } }, { "multi_match": { "query": "{{my_value}}", "fields": "{{.}}_*_nGramValue^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } } ] } }, "{{/my_field}}" ] } } }, "params": { "my_field": [ "1_1", "1_2" ], "my_value": "book" } }

which is rendered as:
{ "template_output": { "size": 20, "explain": false, "query": { "bool": { "should": [ "", { "dis_max": { "tie_breaker": 0, "queries": [ { "multi_match": { "query": "book", "fields": "1_1_*_value^100", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } }, { "multi_match": { "query": "book", "fields": "1_1_*_value^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 2 } }, { "multi_match": { "query": "book", "fields": "1_1_*_nGramValue^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } } ] } }, "", { "dis_max": { "tie_breaker": 0, "queries": [ { "multi_match": { "query": "book", "fields": "1_2_*_value^100", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } }, { "multi_match": { "query": "book", "fields": "1_2_*_value^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 2 } }, { "multi_match": { "query": "book", "fields": "1_2_*_nGramValue^3", "type": "best_fields", "tie_breaker": 0, "fuzziness": 0 } } ] } }, "" ] } } } }

the result has some extra quote ("") and my query does not execute.
why these quotes are added?


(system) #2