{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/16651","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16651/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16651/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16651/events","html_url":"https://github.com/elastic/elasticsearch/issues/16651","id":133420351,"number":16651,"title":"Indexed scripts should be stored in cluster state","user":{"login":"martijnvg","id":580421,"avatar_url":"https://avatars.githubusercontent.com/u/580421?v=3","gravatar_id":"","url":"https://api.github.com/users/martijnvg","html_url":"https://github.com/martijnvg","followers_url":"https://api.github.com/users/martijnvg/followers","following_url":"https://api.github.com/users/martijnvg/following{/other_user}","gists_url":"https://api.github.com/users/martijnvg/gists{/gist_id}","starred_url":"https://api.github.com/users/martijnvg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martijnvg/subscriptions","organizations_url":"https://api.github.com/users/martijnvg/orgs","repos_url":"https://api.github.com/users/martijnvg/repos","events_url":"https://api.github.com/users/martijnvg/events{/privacy}","received_events_url":"https://api.github.com/users/martijnvg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Indexed%20Scripts/Templates","name":":Indexed Scripts/Templates","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/adoptme","name":"adoptme","color":"207de5"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/breaking","name":"breaking","color":"ff0000"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-13T10:22:40Z","updated_at":"2016-02-13T21:21:20Z","closed_at":null,"body":"Indexed scripts are now stored in a dedicated index. Moving indexed scripts to the cluster state will make the indexed script logic much simpler. We already have dedicated indexed script APIs in place so this shouldn't be too difficult.\r\n\r\nWhen developing this we should think about bwc too, we can the first time we start ES after a full cluster restart decide to copy the scripts from the dedicated index into the cluster state, if we see there is a script index, but no scripts are in the cluster state.\r\n\r\nAlso we should then maybe rename indexed scripts, to stored scripts or something like that."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/183755976","html_url":"https://github.com/elastic/elasticsearch/issues/16651#issuecomment-183755976","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/16651","id":183755976,"user":{"login":"uboness","id":211019,"avatar_url":"https://avatars.githubusercontent.com/u/211019?v=3","gravatar_id":"","url":"https://api.github.com/users/uboness","html_url":"https://github.com/uboness","followers_url":"https://api.github.com/users/uboness/followers","following_url":"https://api.github.com/users/uboness/following{/other_user}","gists_url":"https://api.github.com/users/uboness/gists{/gist_id}","starred_url":"https://api.github.com/users/uboness/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uboness/subscriptions","organizations_url":"https://api.github.com/users/uboness/orgs","repos_url":"https://api.github.com/users/uboness/repos","events_url":"https://api.github.com/users/uboness/events{/privacy}","received_events_url":"https://api.github.com/users/uboness/received_events","type":"User","site_admin":false},"created_at":"2016-02-13T21:21:20Z","updated_at":"2016-02-13T21:21:20Z","body":"+1 as well...\r\n\r\nthis will also be a great opportunity to differentiate between scripts & template (today we treat templates as scripts, while they are two different beasts... specially with template needing a context of escaping)\r\n\r\n> When developing this we should think about bwc too, we can the first time we start ES after a full cluster restart decide to copy the scripts from the dedicated index into the cluster state, if we see there is a script index, but no scripts are in the cluster state.\r\n\r\nwould be great if we do this for 3.0 and instead of having this migration done automatically, I think it's better to provide a tool that will do that as part of the 2.x->3.0 migration path.\r\n\r\n> Also we should then maybe rename indexed scripts, to stored scripts or something like that.\r\n\r\n+1"}}