我想更新一份给定的文件;使用保存的脚本
curl -XPOST 'http://localhost:9200/customer92/listbuilder/a10/_update' -d '
{
"_script": {
"script":"summarization"
}
}'
我的 config/scripts 文件夹中有一个 summarization.groovy
。我收到以下错误:
{
"error":
"ElasticsearchIllegalArgumentException[failed to execute script]; nested:
GroovyScriptExecutionException[MissingPropertyException[No such property:
summarization for class: Script6]]; ",
"status":400
}
我做错了什么?
最佳答案
编辑:自从这个答案(来自文档)以来,Elasticsearch 发生了很大变化。请引用最新的文档,例如https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_indexed_scripts
我很确定这个问题不再相关,但如果有人仍然感兴趣的话:
json 中的“脚本”字段应该是一个实际的脚本,而不是脚本的名称。在您的情况下,script_id 是正确的,除非更改了默认值,否则还应添加语言名称。
curl -XPOST 'http://localhost:9200/customer92/listbuilder/a10/_update' -d '
{
"script_id":"总结",
“朗”:“时髦”
}'
有关详细信息,请参阅:Indexed Scripts和 Update API
关于groovy - Elasticsearch 如何在更新中使用脚本(文件),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25415375/