我想更将下面这个数组中 "during":" 888888" 更新成"during":"1"
{
"_index": "log",
"_type": "parse_log",
"_id": "AV80ztgqx-sSsZV5yS9j",
"_version": 2,
"_score": 1,
"_source": {
"ip": "1.1.1.1",
"tag": "主任",
"location": "北京市,北京市,",
"url": [{
"web": "/412/2014/01/16/2@13030.htm",
"access_time": "2017-08-23T03:24:09",
"during": "99999999",
"url_id": "1"
},
{
"web": "/412/2016/06/07/110@24757.htm",
[b]"during": "888888",[/b]
"url_id": "2",
"access_time": "2017-09-11T03:47:03"
}],
"@timestamp": "2017-10-19 21:13:17"
}
}
我用的script {
"script": {
"lang": "painless",
"source": "ctx._source.url.url_id=params.new_url_id;ctx._source.url.during=params.new_during",
"params": {
"new_url_id": "2",
"new_during": "0"
}
}
但是报错
{
"caused_by": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": ["ctx._source.url.url_id=params.new_url_id;",
" ^---- HERE"],
"script": "ctx._source.url.url_id=params.new_url_id;ctx._source.url.during=params.new_during",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Illegal list shortcut value [url_id]."
}
}
}
3 个回复
exceptions - 。。。
赞同来自: richardhej
然后curl -XPOST 'http://ip:9200/log/parse_log/AV83qqH8U7winznYGHpK/_update?pretty' -d @script.json
确实更新了:
由于是低版本的,我把source改成了inline,你的直接用source就行了吧
richardhej
赞同来自:
flytogo
赞同来自: