{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/28921555","id":28921555,"diff_hunk":"@@ -0,0 +1,75 @@\n+/*\n+ * Licensed to Elasticsearch under one or more contributor\n+ * license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright\n+ * ownership. Elasticsearch licenses this file to you under\n+ * the Apache License, Version 2.0 (the \"License\"); you may\n+ * not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.elasticsearch.script;\n+\n+import org.elasticsearch.ElasticsearchIllegalArgumentException;\n+\n+import java.util.Map;\n+\n+import static org.elasticsearch.script.ScriptService.ScriptType;\n+\n+/**\n+ * Script holds all the parameters necessary to compile or find in cache and then execute a script.\n+ */\n+public class Script {\n+\n+    private final String lang;\n+    private final String script;\n+    private final ScriptType type;\n+    private final Map<String, Object> params;\n+\n+    /**\n+     * Constructor for Script.\n+     * @param lang The language of the script to be compiled/executed.\n+     * @param script The cache key of the script to be compiled/executed.  For dynamic scripts this is the actual\n+     *               script source code.  For indexed scripts this is the id used in the request.  For on disk scripts\n+     *               this is the file name.\n+     * @param type The type of script -- dynamic, indexed, or file.\n+     * @param params The map of parameters the script will be executed with.\n+     */\n+    public Script(String lang, String script, ScriptType type, Map<String, Object> params) {\n+        if (script == null) {\n+            throw new ElasticsearchIllegalArgumentException(\"The parameter script (String) must not be null in Script.\");\n+        } else if (type == null) {\n+            throw new ElasticsearchIllegalArgumentException(\"The parameter type (ScriptType) must not be null in Script.\");\n+        }\n+\n+        this.lang = lang;\n+        this.script = script;\n+        this.type = type;\n+        this.params = params;\n+    }\n+\n+    public String lang() {\n+        return lang;\n+    }\n+\n+    public String script() {\n+        return script;\n+    }\n+\n+    public ScriptType type() {\n+        return type;\n+    }\n+\n+    public Map<String, Object> params() {","path":"src/main/java/org/elasticsearch/script/Script.java","position":null,"original_position":72,"commit_id":"a37d3c02ec716dc306f452dfacaad99b1a9d9d72","original_commit_id":"e02c32caec02c37ac80e65642f68abb41a1c81eb","user":{"login":"javanna","id":832460,"avatar_url":"https://avatars.githubusercontent.com/u/832460?v=3","gravatar_id":"","url":"https://api.github.com/users/javanna","html_url":"https://github.com/javanna","followers_url":"https://api.github.com/users/javanna/followers","following_url":"https://api.github.com/users/javanna/following{/other_user}","gists_url":"https://api.github.com/users/javanna/gists{/gist_id}","starred_url":"https://api.github.com/users/javanna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javanna/subscriptions","organizations_url":"https://api.github.com/users/javanna/orgs","repos_url":"https://api.github.com/users/javanna/repos","events_url":"https://api.github.com/users/javanna/events{/privacy}","received_events_url":"https://api.github.com/users/javanna/received_events","type":"User","site_admin":false},"body":"@uboness that's what I see doing with new classes in other PRs, I am just adapting to that tendency here. I don't know if any formal decision has been made. No strong opinion on my end, but I tend to consider this user facing through java api at the end of the day, although we dont' get there yet with this PR but we should at this point.","created_at":"2015-04-22T22:35:29Z","updated_at":"2015-04-22T22:35:29Z","html_url":"https://github.com/elastic/elasticsearch/pull/10649#discussion_r28921555","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/28921555"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10649#discussion_r28921555"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649","id":33567317,"html_url":"https://github.com/elastic/elasticsearch/pull/10649","diff_url":"https://github.com/elastic/elasticsearch/pull/10649.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/10649.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10649","number":10649,"state":"open","locked":false,"title":"Scripting: Added a new script construct","user":{"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},"body":"Added an initial script construct to unify the parameters typically passed to\r\nmethods in the ScriptService. This changes the way several public\r\nmethods are called in the ScriptService along with all the callers since\r\nthey must wrap the parameters passed in into a script object. In the future,\r\nparsing parameters can also be moved into this construct along with ToXContent.","created_at":"2015-04-17T17:58:34Z","updated_at":"2015-04-22T22:35:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d9264f8e5d5762bb34abaa9198105526ac2269b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/10649/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/a37d3c02ec716dc306f452dfacaad99b1a9d9d72","head":{"label":"jdconrad:pr/scriptstruct","ref":"pr/scriptstruct","sha":"a37d3c02ec716dc306f452dfacaad99b1a9d9d72","user":{"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},"repo":{"id":33491776,"name":"elasticsearch","full_name":"jdconrad/elasticsearch","owner":{"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},"private":false,"html_url":"https://github.com/jdconrad/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/jdconrad/elasticsearch","forks_url":"https://api.github.com/repos/jdconrad/elasticsearch/forks","keys_url":"https://api.github.com/repos/jdconrad/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jdconrad/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jdconrad/elasticsearch/teams","hooks_url":"https://api.github.com/repos/jdconrad/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/jdconrad/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/jdconrad/elasticsearch/events","assignees_url":"https://api.github.com/repos/jdconrad/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/jdconrad/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/jdconrad/elasticsearch/tags","blobs_url":"https://api.github.com/repos/jdconrad/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jdconrad/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jdconrad/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/jdconrad/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jdconrad/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/jdconrad/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/jdconrad/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/jdconrad/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/jdconrad/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/jdconrad/elasticsearch/subscription","commits_url":"https://api.github.com/repos/jdconrad/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/jdconrad/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/jdconrad/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/jdconrad/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/jdconrad/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/jdconrad/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jdconrad/elasticsearch/merges","archive_url":"https://api.github.com/repos/jdconrad/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jdconrad/elasticsearch/downloads","issues_url":"https://api.github.com/repos/jdconrad/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/jdconrad/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/jdconrad/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/jdconrad/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jdconrad/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/jdconrad/elasticsearch/releases{/id}","created_at":"2015-04-06T16:19:42Z","updated_at":"2015-04-17T16:43:17Z","pushed_at":"2015-04-22T22:19:28Z","git_url":"git://github.com/jdconrad/elasticsearch.git","ssh_url":"git@github.com:jdconrad/elasticsearch.git","clone_url":"https://github.com/jdconrad/elasticsearch.git","svn_url":"https://github.com/jdconrad/elasticsearch","homepage":"http://elasticsearch.org","size":117425,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"2627324ac2399c43a59956d67856e02abec6f5d2","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","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,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","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}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-04-22T22:32:33Z","pushed_at":"2015-04-22T22:19:31Z","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":"http://elasticsearch.org","size":337165,"stargazers_count":10904,"watchers_count":10904,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3421,"mirror_url":null,"open_issues_count":1120,"forks":3421,"open_issues":1120,"watchers":10904,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/10649"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10649"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/10649/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/10649/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/a37d3c02ec716dc306f452dfacaad99b1a9d9d72"}}}}