{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/20796","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20796/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20796/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20796/events","html_url":"https://github.com/elastic/elasticsearch/pull/20796","id":181604823,"number":20796,"title":"Removes the now callable in the date math parser in favour of a LongSupplier","user":{"login":"colings86","id":236731,"avatar_url":"https://avatars.githubusercontent.com/u/236731?v=3","gravatar_id":"","url":"https://api.github.com/users/colings86","html_url":"https://github.com/colings86","followers_url":"https://api.github.com/users/colings86/followers","following_url":"https://api.github.com/users/colings86/following{/other_user}","gists_url":"https://api.github.com/users/colings86/gists{/gist_id}","starred_url":"https://api.github.com/users/colings86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colings86/subscriptions","organizations_url":"https://api.github.com/users/colings86/orgs","repos_url":"https://api.github.com/users/colings86/repos","events_url":"https://api.github.com/users/colings86/events{/privacy}","received_events_url":"https://api.github.com/users/colings86/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Internal","name":":Internal","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/non-issue","name":"non-issue","color":"cfcfcf"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/review","name":"review","color":"0052cc"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v5.1.0","name":"v5.1.0","color":"dddddd"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v6.0.0","name":"v6.0.0","color":"dddddd"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-07T07:48:38Z","updated_at":"2016-10-11T03:27:57Z","closed_at":"2016-10-07T09:26:26Z","pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/20796","html_url":"https://github.com/elastic/elasticsearch/pull/20796","diff_url":"https://github.com/elastic/elasticsearch/pull/20796.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/20796.patch"},"body":"Previous to this change the `DateMathParser` accepted a `Callable<Long>` to use for accessing the now value. The implementations of this callable would fall back on `System.currentTimeMillis()` if there was no context object provided. This is no longer necessary for two reasons:\r\n\r\n* We should not fall back to `System.currentTimeMillis()` as a context should always be provided. This ensures consistency between shards for the now value in all cases\r\n* We should use a LongSupplier rather than requiring an implementation of Callable<Long>. This means that we can just pass in `context::noInMillis` for this parameter and not have not implement anything."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/252802240","html_url":"https://github.com/elastic/elasticsearch/pull/20796#issuecomment-252802240","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20796","id":252802240,"user":{"login":"dakrone","id":19060,"avatar_url":"https://avatars.githubusercontent.com/u/19060?v=3","gravatar_id":"","url":"https://api.github.com/users/dakrone","html_url":"https://github.com/dakrone","followers_url":"https://api.github.com/users/dakrone/followers","following_url":"https://api.github.com/users/dakrone/following{/other_user}","gists_url":"https://api.github.com/users/dakrone/gists{/gist_id}","starred_url":"https://api.github.com/users/dakrone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakrone/subscriptions","organizations_url":"https://api.github.com/users/dakrone/orgs","repos_url":"https://api.github.com/users/dakrone/repos","events_url":"https://api.github.com/users/dakrone/events{/privacy}","received_events_url":"https://api.github.com/users/dakrone/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T03:27:57Z","updated_at":"2016-10-11T03:27:57Z","body":"Here's a reproduction that shows the NPE on master branch with no changes:\r\n\r\n```json\r\nPUT /test?pretty\r\n{\r\n  \"settings\": {\r\n    \"index\": {\r\n      \"number_of_shards\": 1,\r\n      \"number_of_replicas\": 0\r\n    }\r\n  },\r\n  \"mappings\": {\r\n    \"doc\": {\r\n      \"properties\": {\r\n        \"f1\": {\"type\": \"text\"},\r\n        \"f2\": {\"type\": \"keyword\"},\r\n        \"datef\": {\r\n          \"type\": \"date\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n\r\nPOST /test/doc/1\r\n{\"f1\": \"foo bar baz\"}\r\n\r\nGET /test/_search?pretty\r\n{\r\n  \"query\": {\r\n    \"multi_match\": {\r\n      \"query\": \"foo\",\r\n      \"fields\": [\"f*\", \"datef\"],\r\n      \"type\": \"cross_fields\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nAnd the resulting stacktrace:\r\n\r\n```\r\n[elasticsearch] [2016-10-10T21:26:52,372][DEBUG][o.e.a.s.TransportSearchAction] [XT50TAj] All shards failed for phase: [query_fetch]\r\n[elasticsearch] org.elasticsearch.transport.RemoteTransportException: [XT50TAj][127.0.0.1:9300][indices:data/read/search[phase/query+fetch]]\r\n[elasticsearch] Caused by: org.elasticsearch.index.query.QueryShardException: failed to create query: {\r\n[elasticsearch]   \"multi_match\" : {\r\n[elasticsearch]     \"query\" : \"foo\",\r\n[elasticsearch]     \"fields\" : [\r\n[elasticsearch]       \"datef^1.0\",\r\n[elasticsearch]       \"f*^1.0\"\r\n[elasticsearch]     ],\r\n[elasticsearch]     \"type\" : \"cross_fields\",\r\n[elasticsearch]     \"operator\" : \"OR\",\r\n[elasticsearch]     \"slop\" : 0,\r\n[elasticsearch]     \"prefix_length\" : 0,\r\n[elasticsearch]     \"max_expansions\" : 50,\r\n[elasticsearch]     \"lenient\" : false,\r\n[elasticsearch]     \"zero_terms_query\" : \"NONE\",\r\n[elasticsearch]     \"boost\" : 1.0\r\n[elasticsearch]   }\r\n[elasticsearch] }\r\n[elasticsearch] \tat org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:323) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:301) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.parseSource(SearchService.java:653) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.createContext(SearchService.java:530) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:340) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$9(SearchTransportService.java:291) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:551) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_77]\r\n[elasticsearch] \tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_77]\r\n[elasticsearch] \tat java.lang.Thread.run(Thread.java:745) [?:1.8.0_77]\r\n[elasticsearch] Caused by: java.lang.NullPointerException\r\n[elasticsearch] \tat org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.parseToMilliseconds(DateFieldMapper.java:362) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.innerRangeQuery(DateFieldMapper.java:333) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.termQuery(DateFieldMapper.java:304) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery.blendTerm(MultiMatchQuery.java:252) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery$CrossFieldsQueryBuilder.blendTerm(MultiMatchQuery.java:230) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery.blendTermQuery(MultiMatchQuery.java:307) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MatchQuery.parse(MatchQuery.java:235) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery.parseAndApply(MultiMatchQuery.java:62) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery.access$100(MultiMatchQuery.java:49) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery$QueryBuilder.parseGroup(MultiMatchQuery.java:131) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery$CrossFieldsQueryBuilder.buildGroupedQueries(MultiMatchQuery.java:216) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.search.MultiMatchQuery.parse(MultiMatchQuery.java:96) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.MultiMatchQueryBuilder.doToQuery(MultiMatchQueryBuilder.java:748) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.AbstractQueryBuilder.toQuery(AbstractQueryBuilder.java:95) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.QueryShardContext.lambda$toQuery$1(QueryShardContext.java:302) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:319) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:301) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.parseSource(SearchService.java:653) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.createContext(SearchService.java:530) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:501) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:340) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$9(SearchTransportService.java:291) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:551) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:504) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-6.0.0-alpha1-SNAPSHOT.jar:6.0.0-alpha1-SNAPSHOT]\r\n[elasticsearch] \tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_77]\r\n[elasticsearch] \tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_77]\r\n[elasticsearch] \tat java.lang.Thread.run(Thread.java:745) ~[?:1.8.0_77]\r\n```"}}
{"actor":{"display_login":"dakrone"}}