{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/56471446","id":56471446,"diff_hunk":"@@ -461,7 +475,89 @@ public GeoDistanceSortBuilder fromXContent(QueryParseContext context, String ele\n         result.coerce(coerce);\n         result.ignoreMalformed(ignoreMalformed);\n         return result;\n+    }\n+\n+    @Override\n+    public SortField build(QueryShardContext context) throws IOException {\n+        final boolean indexCreatedBeforeV2_0 = context.indexVersionCreated().before(Version.V_2_0_0);\n+        // validation was not available prior to 2.x, so to support bwc percolation queries we only ignore_malformed on 2.x created indexes\n+        List<GeoPoint> localPoints = new ArrayList<GeoPoint>();\n+        for (GeoPoint geoPoint : this.points) {\n+            localPoints.add(new GeoPoint(geoPoint));\n+        }\n+\n+        if (!indexCreatedBeforeV2_0 && !ignoreMalformed) {\n+            for (GeoPoint point : localPoints) {\n+                if (point.lat() > 90.0 || point.lat() < -90.0) {\n+                    throw new ElasticsearchParseException(\"illegal latitude value [{}] for [GeoDistanceSort]\", point.lat());\n+                }\n+                if (point.lon() > 180.0 || point.lon() < -180) {","path":"core/src/main/java/org/elasticsearch/search/sort/GeoDistanceSortBuilder.java","position":70,"original_position":70,"commit_id":"1908d6dc7366ae1a72e1d0390470622ceca5ecda","original_commit_id":"1908d6dc7366ae1a72e1d0390470622ceca5ecda","user":{"login":"MaineC","id":70953,"avatar_url":"https://avatars.githubusercontent.com/u/70953?v=3","gravatar_id":"","url":"https://api.github.com/users/MaineC","html_url":"https://github.com/MaineC","followers_url":"https://api.github.com/users/MaineC/followers","following_url":"https://api.github.com/users/MaineC/following{/other_user}","gists_url":"https://api.github.com/users/MaineC/gists{/gist_id}","starred_url":"https://api.github.com/users/MaineC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MaineC/subscriptions","organizations_url":"https://api.github.com/users/MaineC/orgs","repos_url":"https://api.github.com/users/MaineC/repos","events_url":"https://api.github.com/users/MaineC/events{/privacy}","received_events_url":"https://api.github.com/users/MaineC/received_events","type":"User","site_admin":false},"body":"See above, there's another method for longitude validation.","created_at":"2016-03-17T08:49:41Z","updated_at":"2016-03-17T08:49:41Z","html_url":"https://github.com/elastic/elasticsearch/pull/17146#discussion_r56471446","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/56471446"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17146#discussion_r56471446"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146","id":63093672,"html_url":"https://github.com/elastic/elasticsearch/pull/17146","diff_url":"https://github.com/elastic/elasticsearch/pull/17146.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/17146.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17146","number":17146,"state":"open","locked":false,"title":"Add build() method to SortBuilder implementations","user":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"body":"For the current refactoring of SortBuilders related to #10217,\r\neach SortBuilder should get a build() method that produces a\r\nSortField according to the SortBuilder parameters on the shard.\r\n\r\nThis change also slightly refactors the current parse method in\r\nSortParseElement to extract an internal parse method that returns\r\na list of sort fields only needs a QueryShardContext as input\r\ninstead of a full SearchContext. This allows using this internal\r\nparse method for testing.","created_at":"2016-03-16T16:24:25Z","updated_at":"2016-03-17T08:49:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"253f61baab7bddfb4d97d36501a14f5bba1cbaef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17146/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/1908d6dc7366ae1a72e1d0390470622ceca5ecda","head":{"label":"cbuescher:sort-add-build","ref":"sort-add-build","sha":"1908d6dc7366ae1a72e1d0390470622ceca5ecda","user":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"repo":{"id":28811483,"name":"elasticsearch","full_name":"cbuescher/elasticsearch","owner":{"login":"cbuescher","id":10398885,"avatar_url":"https://avatars.githubusercontent.com/u/10398885?v=3","gravatar_id":"","url":"https://api.github.com/users/cbuescher","html_url":"https://github.com/cbuescher","followers_url":"https://api.github.com/users/cbuescher/followers","following_url":"https://api.github.com/users/cbuescher/following{/other_user}","gists_url":"https://api.github.com/users/cbuescher/gists{/gist_id}","starred_url":"https://api.github.com/users/cbuescher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbuescher/subscriptions","organizations_url":"https://api.github.com/users/cbuescher/orgs","repos_url":"https://api.github.com/users/cbuescher/repos","events_url":"https://api.github.com/users/cbuescher/events{/privacy}","received_events_url":"https://api.github.com/users/cbuescher/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbuescher/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/cbuescher/elasticsearch","forks_url":"https://api.github.com/repos/cbuescher/elasticsearch/forks","keys_url":"https://api.github.com/repos/cbuescher/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbuescher/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbuescher/elasticsearch/teams","hooks_url":"https://api.github.com/repos/cbuescher/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/cbuescher/elasticsearch/events","assignees_url":"https://api.github.com/repos/cbuescher/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/cbuescher/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/cbuescher/elasticsearch/tags","blobs_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbuescher/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/cbuescher/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/cbuescher/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/cbuescher/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/cbuescher/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/cbuescher/elasticsearch/subscription","commits_url":"https://api.github.com/repos/cbuescher/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbuescher/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbuescher/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbuescher/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/cbuescher/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbuescher/elasticsearch/merges","archive_url":"https://api.github.com/repos/cbuescher/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbuescher/elasticsearch/downloads","issues_url":"https://api.github.com/repos/cbuescher/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/cbuescher/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/cbuescher/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/cbuescher/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbuescher/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/cbuescher/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/cbuescher/elasticsearch/deployments","created_at":"2015-01-05T12:21:34Z","updated_at":"2015-01-19T11:05:49Z","pushed_at":"2016-03-16T16:22:54Z","git_url":"git://github.com/cbuescher/elasticsearch.git","ssh_url":"git@github.com:cbuescher/elasticsearch.git","clone_url":"https://github.com/cbuescher/elasticsearch.git","svn_url":"https://github.com/cbuescher/elasticsearch","homepage":"http://elasticsearch.org","size":189868,"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":"0543d46c1dc9624c9938f249633df064bf32b684","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}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2016-03-17T07:53:02Z","pushed_at":"2016-03-17T08:46:11Z","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":297793,"stargazers_count":16106,"watchers_count":16106,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5180,"mirror_url":null,"open_issues_count":1054,"forks":5180,"open_issues":1054,"watchers":16106,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17146"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17146"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17146/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17146/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/1908d6dc7366ae1a72e1d0390470622ceca5ecda"}}}}