elastic/elasticsearch
在 GitHub 查看Update API: Setting ctx.op to random string results in noop
Open
#43,514 创建于 2019年6月22日
:Distributed/CRUDTeam:Distributedhelp wanted
仓库指标
- Star
- (76,700 star)
- PR 合并指标
- (平均合并 2天) (30 天内合并 1,000 个 PR)
描述
Elasticsearch version (bin/elasticsearch --version): 7.1.1
Description of the problem including expected versus actual behavior:
When using a script in the Update API, setting ctx.op to any string will result in a noop. IMO this should throw an exception, if it's anything else than the suggested ones.
This leniency is actually documented with a TODO, but I do not know the history behind that (that todo is from early 2017). Also a warn message is logged.
Steps to reproduce:
DELETE test
PUT test/_doc/1
{
"key" : "value"
}
POST test/_update/1
{
"script": {
"source": "ctx._source.foo = 'bar'; ctx.op ='anything'",
"lang": "painless"
}
}
# document unchanged
GET test/_doc/1