1

I am using Elasticsearch-7.4. I am trying to render a template with partials as per mustache document as follows

 GET _render/template
{
  "source": "{ \"query\": { \"terms\": {{#toJson}}statuses{{/toJson}} }}{{>partial}}",
  "params": {
    "statuses" : {
        "status": [ "pending", "published" ]
    }
  }

But, this request throws the following exception

   {
  "error": {
    "root_cause": [
      {
        "type": "general_script_exception",
        "reason": "Failed to compile inline script [{ \"query\": { \"terms\": {{#toJson}}statuses{{/toJson}} }}{{>partial}}] using lang [mustache]"
      }
    ],
    "type": "general_script_exception",
    "reason": "Failed to compile inline script [{ \"query\": { \"terms\": {{#toJson}}statuses{{/toJson}} }}{{>partial}}] using lang [mustache]",
    "caused_by": {
      "type": "access_control_exception",
      "reason": "access denied (\"java.lang.RuntimePermission\" \"getClassLoader\")"
    }
  },
  "status": 500
}

Since my template is very large and it is nested too deep with repeated partials, I am interested to store and use search template with partials using 'mustache' lang.

Is it possible in elasticsearch-7.4? If so how to render a template with partials?

Achaius
  • 5,904
  • 21
  • 65
  • 122

1 Answers1

2

Partials are not supported in Elasticsearch.

Val
  • 207,596
  • 13
  • 358
  • 360