{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/21375","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21375/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21375/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21375/events","html_url":"https://github.com/elastic/elasticsearch/issues/21375","id":187766920,"number":21375,"title":"Can't remove integer element from array with Painless","user":{"login":"ericofusco","id":5590224,"avatar_url":"https://avatars.githubusercontent.com/u/5590224?v=3","gravatar_id":"","url":"https://api.github.com/users/ericofusco","html_url":"https://github.com/ericofusco","followers_url":"https://api.github.com/users/ericofusco/followers","following_url":"https://api.github.com/users/ericofusco/following{/other_user}","gists_url":"https://api.github.com/users/ericofusco/gists{/gist_id}","starred_url":"https://api.github.com/users/ericofusco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericofusco/subscriptions","organizations_url":"https://api.github.com/users/ericofusco/orgs","repos_url":"https://api.github.com/users/ericofusco/repos","events_url":"https://api.github.com/users/ericofusco/events{/privacy}","received_events_url":"https://api.github.com/users/ericofusco/received_events","type":"User","site_admin":false},"labels":[{"id":322176648,"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Plugin%20Lang%20Painless","name":":Plugin Lang Painless","color":"009800","default":false},{"id":111416437,"url":"https://api.github.com/repos/elastic/elasticsearch/labels/discuss","name":"discuss","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"jdconrad","id":2126764,"avatar_url":"https://avatars.githubusercontent.com/u/2126764?v=3","gravatar_id":"","url":"https://api.github.com/users/jdconrad","html_url":"https://github.com/jdconrad","followers_url":"https://api.github.com/users/jdconrad/followers","following_url":"https://api.github.com/users/jdconrad/following{/other_user}","gists_url":"https://api.github.com/users/jdconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/jdconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdconrad/subscriptions","organizations_url":"https://api.github.com/users/jdconrad/orgs","repos_url":"https://api.github.com/users/jdconrad/repos","events_url":"https://api.github.com/users/jdconrad/events{/privacy}","received_events_url":"https://api.github.com/users/jdconrad/received_events","type":"User","site_admin":false},"assignees":[{"login":"jdconrad","id":2126764,"avatar_url":"https://avatars.githubusercontent.com/u/2126764?v=3","gravatar_id":"","url":"https://api.github.com/users/jdconrad","html_url":"https://github.com/jdconrad","followers_url":"https://api.github.com/users/jdconrad/followers","following_url":"https://api.github.com/users/jdconrad/following{/other_user}","gists_url":"https://api.github.com/users/jdconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/jdconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdconrad/subscriptions","organizations_url":"https://api.github.com/users/jdconrad/orgs","repos_url":"https://api.github.com/users/jdconrad/repos","events_url":"https://api.github.com/users/jdconrad/events{/privacy}","received_events_url":"https://api.github.com/users/jdconrad/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-11-07T16:58:54Z","updated_at":"2016-11-07T18:41:27Z","closed_at":null,"body":"<!--\r\nGitHub is reserved for bug reports and feature requests. The best place\r\nto ask a general question is at the Elastic Discourse forums at\r\nhttps://discuss.elastic.co. If you are in fact posting a bug report or\r\na feature request, please include one and only one of the below blocks\r\nin your new issue. Note that whether you're filing a bug report or a\r\nfeature request, ensure that your submission is for an\r\n[OS that we support](https://www.elastic.co/support/matrix#show_os).\r\nBug reports on an OS that we do not support or feature requests\r\nspecific to an OS that we do not support will be closed.\r\n-->\r\n\r\n<!--\r\nIf you are filing a bug report, please remove the below feature\r\nrequest block and provide responses for all of the below items.\r\n-->\r\n\r\n**Elasticsearch version**: 5.0.0\r\n\r\n**Plugins installed**: []\r\n\r\n**JVM version**: Oracle JRE Server 8u112\r\n\r\n**OS version**: Ubuntu 14.04\r\n\r\n**Description of the problem including expected versus actual behavior**:\r\n\r\n**Steps to reproduce**:\r\n 1. Create a document with array of integer values\r\n 2. Use .remove() with Integer object\r\n\r\nI understand that ElasticSearch uses ArrayList() for arrays, when remove() is used with an integer it removes an element from index position, so it needs to be converted to an Integer object to remove the value, not the position (example: \"inline\": \"ctx._source.field.remove(new Integer(params.value))\",) but I get the error:\r\n\r\n**Unknown new call on type [Integer].**\r\n\r\nWith groovy was easy to do: ctx._source.field -= params.value, now this shortcut doesn't even work with painless."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/258923282","html_url":"https://github.com/elastic/elasticsearch/issues/21375#issuecomment-258923282","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/21375","id":258923282,"user":{"login":"ericofusco","id":5590224,"avatar_url":"https://avatars.githubusercontent.com/u/5590224?v=3","gravatar_id":"","url":"https://api.github.com/users/ericofusco","html_url":"https://github.com/ericofusco","followers_url":"https://api.github.com/users/ericofusco/followers","following_url":"https://api.github.com/users/ericofusco/following{/other_user}","gists_url":"https://api.github.com/users/ericofusco/gists{/gist_id}","starred_url":"https://api.github.com/users/ericofusco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericofusco/subscriptions","organizations_url":"https://api.github.com/users/ericofusco/orgs","repos_url":"https://api.github.com/users/ericofusco/repos","events_url":"https://api.github.com/users/ericofusco/events{/privacy}","received_events_url":"https://api.github.com/users/ericofusco/received_events","type":"User","site_admin":false},"created_at":"2016-11-07T18:41:27Z","updated_at":"2016-11-07T18:41:27Z","body":"@jdconrad,\r\n\r\nThank you. I went with script below.\r\n\r\n`ctx._source.field.removeAll(Collections.singleton(params.value))`\r\n\r\nOn my case I want to make sure no elements with same value are left in the array. That's how it was working on groovy with `-= params.value`. indexOf() only gets the first match. \r\n\r\nShould I expect this script using removeAll() and Collections to break on any near ES updates ?\r\n\r\nJust a FYI, I found another issue that's related to shortcuts with lists: #21027"}}
{"actor":{"display_login":"ericofusco"}}