-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates>bughelp wantedadoptmeadoptme
Description
Elasticsearch version (bin/elasticsearch --version): 6.1.2
Plugins installed: []
Description of the problem including expected versus actual behavior:
The _update API doesn't seem to reject a command that is wrong. Actually, this example comes from The Definitive Guide (which I know it's WIP), but still the ES API should reply back with an error for such a command:
POST /website/blog/1/_update
{
"script": "ctx.op = ctx._source.views == params.count ? 'delete' : 'none'",
"params": {
"count": 1
}
}
This returns:
{
"_index": "website",
"_type": "blog",
"_id": "1",
"_version": 2,
"result": "noop",
"_shards": {
"total": 0,
"successful": 0,
"failed": 0
}
}
Debugging this with Debug.explain(params) shows that there is no params registered. Which, in fact, is fine since the syntax is incorrect: there shouldn't be any params definitions at the root level, but inside script itself. The correct syntax should be:
POST /website/blog/1/_update
{
"script": {
"source": "ctx.op = ctx._source.views == params.count ? 'delete' : 'none'",
"params": {
"count": 1
}
}
}
Metadata
Metadata
Assignees
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates>bughelp wantedadoptmeadoptme