gpt4 book ai didi

elasticsearch - Update API中的elasticsearch python脚本插件

转载 作者:行者123 更新时间:2023-12-02 23:41:26 25 4
gpt4 key购买 nike

我试图在elasticsearch中运行一个简单的更新脚本。
它似乎可以使用mvel很好,但是不能使用python。

curl -XPOST 'localhost:9200/index1/type1/1/_update?pretty=true' 
-d '{"script" : "ctx._source.myfield=\"item\""}'
{
"ok" : true,
"_index" : "index1",
"_type" : "type1",
"_id" : "1",
"_version" : 7
}

curl -XPOST 'localhost:9200/index1/type1/1/_update?pretty=true'
-d '{"script" : "ctx._source.myfield=\"item\"","lang":"python"}'
{
"error" : "ElasticSearchIllegalArgumentException[failed to execute script]; nested: NullPointerException; ",
"status" : 400
}

我的ES版本是0.20.4

我的elasticsearch-lang-python插件是1.1.0(我也尝试过1.2.0)

最佳答案

看起来像python插件中的a bug。您可以添加空参数列表作为解决方法:

curl -XPOST 'localhost:9200/index1/type1/1/_update?pretty=true' -d '{
"script": "ctx[\"_source\"][\"myfield\"]=\"foo\"",
"lang": "python",
"params": {}
}'

关于elasticsearch - Update API中的elasticsearch python脚本插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15493590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com