{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/203639166","pull_request_review_id":138566871,"id":203639166,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMzYzOTE2Ng==","diff_hunk":"@@ -48,19 +50,21 @@\n         private final LongAccessor supersetSizeHolder;\n         private final LongAccessor subsetDfHolder;\n         private final LongAccessor supersetDfHolder;\n-        private final ExecutableScript executableScript;\n+        private final BucketAggregateToDoubleScript executableScript;\n+        private final Map<String, Object> params = new HashMap<>();\n \n-        ExecutableScriptHeuristic(Script script, ExecutableScript executableScript){\n+        ExecutableScriptHeuristic(Script script, BucketAggregateToDoubleScript executableScript) {\n             super(script);\n             subsetSizeHolder = new LongAccessor();\n             supersetSizeHolder = new LongAccessor();\n             subsetDfHolder = new LongAccessor();\n             supersetDfHolder = new LongAccessor();\n             this.executableScript = executableScript;\n-            executableScript.setNextVar(\"_subset_freq\", subsetDfHolder);\n-            executableScript.setNextVar(\"_subset_size\", subsetSizeHolder);\n-            executableScript.setNextVar(\"_superset_freq\", supersetDfHolder);\n-            executableScript.setNextVar(\"_superset_size\", supersetSizeHolder);\n+            params.putAll(script.getParams());","path":"server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/heuristics/ScriptHeuristic.java","position":36,"original_position":36,"commit_id":"145e11f4f37cf7d6f353b32817065569072d2b79","original_commit_id":"ba8fd94e96a5b3b924a1a46c093ac8a117244a2d","user":{"login":"original-brownbear","id":6490959,"node_id":"MDQ6VXNlcjY0OTA5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6490959?v=4","gravatar_id":"","url":"https://api.github.com/users/original-brownbear","html_url":"https://github.com/original-brownbear","followers_url":"https://api.github.com/users/original-brownbear/followers","following_url":"https://api.github.com/users/original-brownbear/following{/other_user}","gists_url":"https://api.github.com/users/original-brownbear/gists{/gist_id}","starred_url":"https://api.github.com/users/original-brownbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/original-brownbear/subscriptions","organizations_url":"https://api.github.com/users/original-brownbear/orgs","repos_url":"https://api.github.com/users/original-brownbear/repos","events_url":"https://api.github.com/users/original-brownbear/events{/privacy}","received_events_url":"https://api.github.com/users/original-brownbear/received_events","type":"User","site_admin":false},"body":"@rjernst but currently these are documented as `params` aren't they? See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-significantterms-aggregation.html#_scripted\r\n\r\nAlso under the hood `org.elasticsearch.painless.ScriptImpl` simply puts these under `params`, these aren't available as top level params are they?","created_at":"2018-07-19T08:21:55Z","updated_at":"2018-07-19T08:21:55Z","html_url":"https://github.com/elastic/elasticsearch/pull/32068#discussion_r203639166","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/203639166"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/32068#discussion_r203639166"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068"}},"in_reply_to_id":203493721},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068","id":201507453,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxNTA3NDUz","html_url":"https://github.com/elastic/elasticsearch/pull/32068","diff_url":"https://github.com/elastic/elasticsearch/pull/32068.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/32068.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/32068","number":32068,"state":"open","locked":false,"title":"SCRIPTING: Move Aggregation Scripts to their own context","user":{"login":"original-brownbear","id":6490959,"node_id":"MDQ6VXNlcjY0OTA5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6490959?v=4","gravatar_id":"","url":"https://api.github.com/users/original-brownbear","html_url":"https://github.com/original-brownbear","followers_url":"https://api.github.com/users/original-brownbear/followers","following_url":"https://api.github.com/users/original-brownbear/following{/other_user}","gists_url":"https://api.github.com/users/original-brownbear/gists{/gist_id}","starred_url":"https://api.github.com/users/original-brownbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/original-brownbear/subscriptions","organizations_url":"https://api.github.com/users/original-brownbear/orgs","repos_url":"https://api.github.com/users/original-brownbear/repos","events_url":"https://api.github.com/users/original-brownbear/events{/privacy}","received_events_url":"https://api.github.com/users/original-brownbear/received_events","type":"User","site_admin":false},"body":"Same as #32003 in motivation, handling another step of the todo.\r\n\r\nAlso, handled another todo in `BucketSelectorPipelineAggregator` by moving `params` from being a field on the compiled script to being an input so that the new type `BucketAggregationScript` is stateless and can be reused in loops.","created_at":"2018-07-15T17:36:03Z","updated_at":"2018-07-19T08:21:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41b8eb30eb5b6c98246a209046a4a9c0ac273870","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":146834791,"node_id":"MDU6TGFiZWwxNDY4MzQ3OTE=","url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Core/Scripting","name":":Core/Scripting","color":"0e8a16","default":false},{"id":837440720,"node_id":"MDU6TGFiZWw4Mzc0NDA3MjA=","url":"https://api.github.com/repos/elastic/elasticsearch/labels/%3Erefactoring","name":">refactoring","color":"dddddd","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/32068/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/145e11f4f37cf7d6f353b32817065569072d2b79","head":{"label":"original-brownbear:replace-agg-script-context","ref":"replace-agg-script-context","sha":"145e11f4f37cf7d6f353b32817065569072d2b79","user":{"login":"original-brownbear","id":6490959,"node_id":"MDQ6VXNlcjY0OTA5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6490959?v=4","gravatar_id":"","url":"https://api.github.com/users/original-brownbear","html_url":"https://github.com/original-brownbear","followers_url":"https://api.github.com/users/original-brownbear/followers","following_url":"https://api.github.com/users/original-brownbear/following{/other_user}","gists_url":"https://api.github.com/users/original-brownbear/gists{/gist_id}","starred_url":"https://api.github.com/users/original-brownbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/original-brownbear/subscriptions","organizations_url":"https://api.github.com/users/original-brownbear/orgs","repos_url":"https://api.github.com/users/original-brownbear/repos","events_url":"https://api.github.com/users/original-brownbear/events{/privacy}","received_events_url":"https://api.github.com/users/original-brownbear/received_events","type":"User","site_admin":false},"repo":{"id":92321292,"node_id":"MDEwOlJlcG9zaXRvcnk5MjMyMTI5Mg==","name":"elasticsearch","full_name":"original-brownbear/elasticsearch","owner":{"login":"original-brownbear","id":6490959,"node_id":"MDQ6VXNlcjY0OTA5NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/6490959?v=4","gravatar_id":"","url":"https://api.github.com/users/original-brownbear","html_url":"https://github.com/original-brownbear","followers_url":"https://api.github.com/users/original-brownbear/followers","following_url":"https://api.github.com/users/original-brownbear/following{/other_user}","gists_url":"https://api.github.com/users/original-brownbear/gists{/gist_id}","starred_url":"https://api.github.com/users/original-brownbear/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/original-brownbear/subscriptions","organizations_url":"https://api.github.com/users/original-brownbear/orgs","repos_url":"https://api.github.com/users/original-brownbear/repos","events_url":"https://api.github.com/users/original-brownbear/events{/privacy}","received_events_url":"https://api.github.com/users/original-brownbear/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/original-brownbear/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/original-brownbear/elasticsearch","forks_url":"https://api.github.com/repos/original-brownbear/elasticsearch/forks","keys_url":"https://api.github.com/repos/original-brownbear/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/original-brownbear/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/original-brownbear/elasticsearch/teams","hooks_url":"https://api.github.com/repos/original-brownbear/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/original-brownbear/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/original-brownbear/elasticsearch/events","assignees_url":"https://api.github.com/repos/original-brownbear/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/original-brownbear/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/original-brownbear/elasticsearch/tags","blobs_url":"https://api.github.com/repos/original-brownbear/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/original-brownbear/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/original-brownbear/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/original-brownbear/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/original-brownbear/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/original-brownbear/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/original-brownbear/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/original-brownbear/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/original-brownbear/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/original-brownbear/elasticsearch/subscription","commits_url":"https://api.github.com/repos/original-brownbear/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/original-brownbear/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/original-brownbear/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/original-brownbear/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/original-brownbear/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/original-brownbear/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/original-brownbear/elasticsearch/merges","archive_url":"https://api.github.com/repos/original-brownbear/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/original-brownbear/elasticsearch/downloads","issues_url":"https://api.github.com/repos/original-brownbear/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/original-brownbear/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/original-brownbear/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/original-brownbear/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/original-brownbear/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/original-brownbear/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/original-brownbear/elasticsearch/deployments","created_at":"2017-05-24T18:00:17Z","updated_at":"2017-05-24T18:01:04Z","pushed_at":"2018-07-19T07:57:44Z","git_url":"git://github.com/original-brownbear/elasticsearch.git","ssh_url":"git@github.com:original-brownbear/elasticsearch.git","clone_url":"https://github.com/original-brownbear/elasticsearch.git","svn_url":"https://github.com/original-brownbear/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":470170,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"644a92f1582ceeda6981c0653a5e455f5ec43e3c","user":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"node_id":"MDEwOlJlcG9zaXRvcnk1MDc3NzU=","name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY3NjQzOTA=","avatar_url":"https://avatars0.githubusercontent.com/u/6764390?v=4","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2018-07-19T07:52:19Z","pushed_at":"2018-07-19T07:57:49Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":497319,"stargazers_count":32682,"watchers_count":32682,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11175,"mirror_url":null,"archived":false,"open_issues_count":1545,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":11175,"open_issues":1545,"watchers":32682,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/32068"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/32068"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/32068/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/32068/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/145e11f4f37cf7d6f353b32817065569072d2b79"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"original-brownbear"}}