Search template rendering behavior is inconsistent when trying to render a JSON array in a template.
When using "generic" search templates, JSON arrays cannot be rendered without hacky workarounds due to a trailing comma appearing after the last item in the array.
However, when using search templates with search applications, you can render JSON arrays much more easily due to fixes applied only in the context of search templates used for search applications (see PRs #95200 & #96197).
This inconsistency is a) confusing and b) undocumented. From the perspective of an external user, JSON array rendering auto-magically works with only search applications.
Elasticsearch Version
8.10.3
Installed Plugins
No response
Java Version
bundled
OS Version
Cloud
Problem Description
Search template rendering behavior is inconsistent when trying to render a JSON array in a template.
When using "generic" search templates, JSON arrays cannot be rendered without hacky workarounds due to a trailing comma appearing after the last item in the array.
However, when using search templates with search applications, you can render JSON arrays much more easily due to fixes applied only in the context of search templates used for search applications (see PRs #95200 & #96197).
This inconsistency is a) confusing and b) undocumented. From the perspective of an external user, JSON array rendering auto-magically works with only search applications.
Steps to Reproduce
Elasticsearch currently returns a JSON parsing exception due to the generated JSON array containing a trailing comma:
Logs (if relevant)
No response