-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Closed
Labels
Description
In the JavaScript tests I'm trying to validate the error output when specifying an invalid mustache template, and while the correct error is produced, it is not sent in the API response as the root cause.
@colings86 mentioned this is likely a bug in the exception XContent rendering. (whatever that means 😸)
Here is a trace of the request:
-> POST http://localhost:9406/_render/template
{
"inline": "{ \"query\": { \"match\": { \"text\": \"{{{my_value}}\" } }, \"size\": {{my_size}} }",
"params": {
"my_value": "bar",
"my_size": 100
}
}
<- 500
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "Failed to compile inline script [{ \"query\": { \"match\": { \"text\": \"{{{my_value}}\" } }, \"size\": {{my_size}} }] using lang [mustache]"
}
],
"type": "script_exception",
"reason": "Failed to compile inline script [{ \"query\": { \"match\": { \"text\": \"{{{my_value}}\" } }, \"size\": {{my_size}} }] using lang [mustache]",
"caused_by": {
"type": "mustache_exception",
"reason": "Improperly closed variable in query-template:1"
}
},
"status": 500
}
And the test that produced it:
Lines 52 to 55 in d4b94a9
- do: | |
catch: /Improperly.closed.variable.in.query-template/ | |
render_search_template: | |
body: { "inline": { "query": { "match": { "text": "{{{my_value}}" } }, "aggs": { "my_terms": { "terms": { "field": "{{my_field}}" } } } }, "params": { "my_value": "bar", "my_field": "field1" } } |