{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/31607692","id":31607692,"diff_hunk":"@@ -192,4 +197,47 @@ public DateTimeField getField(Chronology chronology) {\n             return new OffsetDateTimeField(new DividedDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), QuarterOfYear, 3), 1);\n         }\n     };\n+\n+    public static class EpochTimeParser implements DateTimeParser {\n+\n+        private static final Pattern milliSecondPrecisionPattern = Pattern.compile(\"^\\\\d{1,13}$\");\n+        private static final Pattern secondPrecisionPattern = Pattern.compile(\"^\\\\d{1,10}$\");\n+\n+        private final boolean hasMilliSecondPrecision;\n+        private final Pattern pattern;\n+\n+        public EpochTimeParser(boolean hasMilliSecondPrecision) {\n+            this.hasMilliSecondPrecision = hasMilliSecondPrecision;\n+            this.pattern = hasMilliSecondPrecision ? milliSecondPrecisionPattern : secondPrecisionPattern;\n+        }\n+\n+        @Override\n+        public int estimateParsedLength() {\n+            return hasMilliSecondPrecision ? 13 : 10;\n+        }\n+\n+        @Override\n+        public int parseInto(DateTimeParserBucket bucket, String text, int position) {\n+            if (text.length() > estimateParsedLength() || !pattern.matcher(text).matches()) {","path":"src/main/java/org/elasticsearch/common/joda/Joda.java","position":null,"original_position":44,"commit_id":"2d55d8c4069dfb84f078d500dfb9992b24797aa0","original_commit_id":"d04ff1d133ee164b751f3a5c50201cd3060556fa","user":{"login":"spinscale","id":667544,"avatar_url":"https://avatars.githubusercontent.com/u/667544?v=3","gravatar_id":"","url":"https://api.github.com/users/spinscale","html_url":"https://github.com/spinscale","followers_url":"https://api.github.com/users/spinscale/followers","following_url":"https://api.github.com/users/spinscale/following{/other_user}","gists_url":"https://api.github.com/users/spinscale/gists{/gist_id}","starred_url":"https://api.github.com/users/spinscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinscale/subscriptions","organizations_url":"https://api.github.com/users/spinscale/orgs","repos_url":"https://api.github.com/users/spinscale/repos","events_url":"https://api.github.com/users/spinscale/events{/privacy}","received_events_url":"https://api.github.com/users/spinscale/received_events","type":"User","site_admin":false},"body":"fixed","created_at":"2015-06-03T09:42:22Z","updated_at":"2015-06-03T09:42:22Z","html_url":"https://github.com/elastic/elasticsearch/pull/11453#discussion_r31607692","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/31607692"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11453#discussion_r31607692"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453","id":36720460,"html_url":"https://github.com/elastic/elasticsearch/pull/11453","diff_url":"https://github.com/elastic/elasticsearch/pull/11453.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/11453.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11453","number":11453,"state":"open","locked":false,"title":"Dates: Added epoch date formats to configure parsing of unix dates","user":{"login":"spinscale","id":667544,"avatar_url":"https://avatars.githubusercontent.com/u/667544?v=3","gravatar_id":"","url":"https://api.github.com/users/spinscale","html_url":"https://github.com/spinscale","followers_url":"https://api.github.com/users/spinscale/followers","following_url":"https://api.github.com/users/spinscale/following{/other_user}","gists_url":"https://api.github.com/users/spinscale/gists{/gist_id}","starred_url":"https://api.github.com/users/spinscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinscale/subscriptions","organizations_url":"https://api.github.com/users/spinscale/orgs","repos_url":"https://api.github.com/users/spinscale/repos","events_url":"https://api.github.com/users/spinscale/events{/privacy}","received_events_url":"https://api.github.com/users/spinscale/received_events","type":"User","site_admin":false},"body":"This PR adds the support the new date formats, namely `epoch_second` and `epoch_second_millis`. By adding those, we can remove the internal logic to try and parse everything as a unix timestamp first and only then use our regular date format.\r\n\r\nThis PR tries to remain backwards compatible by using `epoch_second_millis||dateOptionalTime` where before only `dateOptionalTime` was used in combination with the parsing.\r\n\r\nSome BWC occured, ie, a date like `10000` is now always a year without any other configuration instead of a unix timestamp.\r\n\r\nAlso, in the current implementation, the `RangeQueryParser` allows to configure a timezone for queries using `from`/`to` unix timestamps, even though the timezone is ignored in the query, as a timestamp is always UTC.\r\n\r\nCloses #5328\r\nRelates #10971","created_at":"2015-06-02T11:56:55Z","updated_at":"2015-06-03T09:42:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c184503f4c1c7ecea7969ea59d5b7591eae41e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11453/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/2d55d8c4069dfb84f078d500dfb9992b24797aa0","head":{"label":"spinscale:1506-add-epoch-to-named-date-formats","ref":"1506-add-epoch-to-named-date-formats","sha":"2d55d8c4069dfb84f078d500dfb9992b24797aa0","user":{"login":"spinscale","id":667544,"avatar_url":"https://avatars.githubusercontent.com/u/667544?v=3","gravatar_id":"","url":"https://api.github.com/users/spinscale","html_url":"https://github.com/spinscale","followers_url":"https://api.github.com/users/spinscale/followers","following_url":"https://api.github.com/users/spinscale/following{/other_user}","gists_url":"https://api.github.com/users/spinscale/gists{/gist_id}","starred_url":"https://api.github.com/users/spinscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinscale/subscriptions","organizations_url":"https://api.github.com/users/spinscale/orgs","repos_url":"https://api.github.com/users/spinscale/repos","events_url":"https://api.github.com/users/spinscale/events{/privacy}","received_events_url":"https://api.github.com/users/spinscale/received_events","type":"User","site_admin":false},"repo":{"id":8698747,"name":"elasticsearch","full_name":"spinscale/elasticsearch","owner":{"login":"spinscale","id":667544,"avatar_url":"https://avatars.githubusercontent.com/u/667544?v=3","gravatar_id":"","url":"https://api.github.com/users/spinscale","html_url":"https://github.com/spinscale","followers_url":"https://api.github.com/users/spinscale/followers","following_url":"https://api.github.com/users/spinscale/following{/other_user}","gists_url":"https://api.github.com/users/spinscale/gists{/gist_id}","starred_url":"https://api.github.com/users/spinscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinscale/subscriptions","organizations_url":"https://api.github.com/users/spinscale/orgs","repos_url":"https://api.github.com/users/spinscale/repos","events_url":"https://api.github.com/users/spinscale/events{/privacy}","received_events_url":"https://api.github.com/users/spinscale/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spinscale/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/spinscale/elasticsearch","forks_url":"https://api.github.com/repos/spinscale/elasticsearch/forks","keys_url":"https://api.github.com/repos/spinscale/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spinscale/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spinscale/elasticsearch/teams","hooks_url":"https://api.github.com/repos/spinscale/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/spinscale/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/spinscale/elasticsearch/events","assignees_url":"https://api.github.com/repos/spinscale/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/spinscale/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/spinscale/elasticsearch/tags","blobs_url":"https://api.github.com/repos/spinscale/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spinscale/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spinscale/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/spinscale/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spinscale/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/spinscale/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/spinscale/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/spinscale/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/spinscale/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/spinscale/elasticsearch/subscription","commits_url":"https://api.github.com/repos/spinscale/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/spinscale/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/spinscale/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/spinscale/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/spinscale/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/spinscale/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spinscale/elasticsearch/merges","archive_url":"https://api.github.com/repos/spinscale/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spinscale/elasticsearch/downloads","issues_url":"https://api.github.com/repos/spinscale/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/spinscale/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/spinscale/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/spinscale/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spinscale/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/spinscale/elasticsearch/releases{/id}","created_at":"2013-03-11T07:47:35Z","updated_at":"2015-03-10T00:44:51Z","pushed_at":"2015-06-03T09:41:42Z","git_url":"git://github.com/spinscale/elasticsearch.git","ssh_url":"git@github.com:spinscale/elasticsearch.git","clone_url":"https://github.com/spinscale/elasticsearch.git","svn_url":"https://github.com/spinscale/elasticsearch","homepage":"http://elasticsearch.org","size":112587,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"59d9f7e1579ca70973d14e94da0b8794e60f3b85","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-06-03T09:08:09Z","pushed_at":"2015-06-03T09:41:45Z","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":1901235,"stargazers_count":11441,"watchers_count":11441,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3620,"mirror_url":null,"open_issues_count":1098,"forks":3620,"open_issues":1098,"watchers":11441,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11453"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11453"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11453/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11453/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/2d55d8c4069dfb84f078d500dfb9992b24797aa0"}}}}