企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 脚本变化(Scripting changes ) 1\. 移除Groovy, JavaScript, and Python等脚本语言 roovy, JavaScript, and Python等脚本语法已经在5.0版不再推荐使用,现在这些脚本语言已经被移除.取而代之的是推荐是painless语言. 2\. 移除本地脚本 本地脚本都被移除,取而代之的是,请实现"ScriptEngine" 3\. 移除脚本文件 脚本文件已经都被移除.取而代之的是使用存储脚本.同时,关联设置"path.scripts"也已经被移除. 4\. 日期字段现在返回日期 由于使用epoch(时间点)过长,在"doc.some_date_field.value"中的字段现在返回"ReadableDateTime"取代milliseconds.同样的还有doc.some_date_field[some_number].如果你需要获取毫秒数,你可以使用doc.some_date_field.value.millis来获取毫秒数 5\. 移除通过索引内部变量"_index"来访问索引 "_index"变量已经被移除.如果你需要使用它来进行高级评分,请考虑自己实现一个"Similarity"插件. 6\. 脚本设置 所有存在脚本安全的设置都被移除.取而代之的是两个新的设置,script.allowed_types和script.allowed_contexts 7\. 当存储脚本作为请求的一部分时,不再需要指定"lang"参数 当发送存储脚本请求时,"lang"参数不再需要进行指定,否则会出现一个错误.请注意,一个使用存储脚本的请求不同于一个设置存储脚本的请求.脚本语言已经存储为集群状态的一部分,“id”足以访问执行存储脚本所需的所有信息. The `lang` variable can no longer be specified as part of a request that uses a stored script otherwise an error will occur. Note that a request using a stored script is different from a request that puts a stored script. The language of the script has already been stored as part of the cluster state and an `id` is sufficient to access all of the information necessary to execute a stored script. 8\. 当进行脚本设置,获取,或者删除一个存储脚本的时候,脚本参数"lang"不再使用 当你在"_scripts"路径下使执行put,get,和delete操作的时候,不再需要指定"lang"参数作为url请求的一部分.所有的存储脚本必须有一个唯一的"id"作为唯一的命名空间,而不再需要"lang"和"id"一起作为唯一的命名空间. Stored scripts can no longer have the `lang` parameter specified as part of the url when performing PUT, GET, and DELETE actions on the `_scripts/` path. All stored scripts must have a unique `id` as the namespace is only `id` now and no longer `lang` and `id`. 9\. 移除存储查询模板API 使用"_search/template" api 进行 put,get 和 delete操作都被移除.存储查询模板API已经被存储脚本API取代. 例如,之前你可能存储了如下查询模板: ~~~ PUT /_search/template/custom_template { "query": { "match": { "f1": "{{f1}}" } } } ~~~ 取而代之的是如下的存储脚本: ~~~ PUT /_scripts/custom_template { "script": { "lang": "mustache", "source": { "query": { "match": { "f1": "{{f1}}" } } } } } ~~~