1

我希望下面的 Elasticsearch 查询参数化,因为有时我会收到这样的错误。

[脚本] 一分钟内动态脚本编译过多,最大值:[15/分钟];请改用磁盘、索引或带参数的脚本;此限制可以通过 [script.max_compilations_per_minute] 更改

如果我们使用索引脚本或基于文件的脚本是否有助于消除此错误?

 {
   "query": {
      "bool": {
         "must": [
            {
               "query_string": {
                  "query": "a*",
                  "quote_analyzer": "standard",
                  "allow_leading_wildcard": "true",
                  "analyze_wildcard": "true",
                  "default_operator": "AND",
                  "phrase_slop": 1
               }
            },
            {
               "script": {
                  "script": {
                     "source": "Pattern p =  /\\s?a\\S*?/i;   p.matcher(params._source.summary ?: '').find();",
                     "lang": "painless"
                  }
               }
            }
         ]
      }
   }
}

我不想更新或增加 script.max_compilations_per_minute 因为它是 CPU 密集型的。

我尝试了索引或文件基本脚本的几个选项,但没有成功。

4

0 回答 0