【问题标题】:Elastic search templates with partials带有部分的弹性搜索模板
【发布时间】:2019-11-08 09:12:30
【问题描述】:

我正在使用 Elasticsearch-7.4。我正在尝试根据 mustache 文档呈现带有部分的模板,如下所示

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

但是,这个请求会抛出以下异常

   {
  "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
}

由于我的模板非常大,并且嵌套太深且带有重复的部分,我有兴趣使用“mustache”语言存储和使用带有部分的搜索模板。

在 elasticsearch-7.4 中可以吗?如果是这样如何渲染带有部分的模板?

【问题讨论】:

    标签: elasticsearch mustache elasticsearch-template


    【解决方案1】:

    部分是 Elasticsearch 中的 not supported

    【讨论】:

    • 有没有其他方法可以从一个模板中引用/提取另一个 es 模板?
    • 我不知道。
    • 如果有帮助,您应该考虑接受答案 ;-)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 2021-06-28
    • 2021-11-19
    相关资源
    最近更新 更多