Closed
Description
In 5.6 there are two types of id's for stored scripts. 1) lang#id and 2) id -- The first one was deprecated; however, since both could be referenced during script usage when a put stored script request was issued, both types were added for the same script. Example:
POST _scripts/foo
{
"script": {
"lang": "painless",
"source": "def hello=\"world\""
}
}
GET /_cluster/state?filter_path=metadata.stored_scripts
results in the following:
{
"metadata": {
"stored_scripts": {
"foo": {
"lang": "painless",
"source": """def hello="world"""",
"options": {}
},
"painless#foo": {
"lang": "painless",
"source": """def hello="world"""",
"options": {}
}
}
}
}
When upgrading to 6.0, though, it's no longer possible to get/put/delete stored scripts with the deprecated id format (lang#id), but we still load the scripts saved in the cluster state from the previous version with that format and never convert it to the id only type. This means legacy scripts exist in the cluster state that cannot be accessed or deleted. The potential fix is to convert the old style scripts to the new style in all situations.