{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/30429491","id":30429491,"diff_hunk":"@@ -66,12 +66,7 @@ public final void handleRequest(RestRequest request, RestChannel channel) throws\n         }\n \n         private static void copyHeadersAndContext(ActionRequest actionRequest, RestRequest restRequest, Set<String> headers) {\n-            for (String usefulHeader : headers) {\n-                String headerValue = restRequest.header(usefulHeader);\n-                if (headerValue != null) {\n-                    actionRequest.putHeader(usefulHeader, headerValue);\n-                }\n-            }\n+            actionRequest.copyHeadersFrom(actionRequest);","path":"src/main/java/org/elasticsearch/rest/BaseRestHandler.java","position":10,"original_position":10,"commit_id":"2ff809718d16b1ab337dff05cba70ea253df2683","original_commit_id":"2ff809718d16b1ab337dff05cba70ea253df2683","user":{"login":"jaymode","id":4339958,"avatar_url":"https://avatars.githubusercontent.com/u/4339958?v=3","gravatar_id":"","url":"https://api.github.com/users/jaymode","html_url":"https://github.com/jaymode","followers_url":"https://api.github.com/users/jaymode/followers","following_url":"https://api.github.com/users/jaymode/following{/other_user}","gists_url":"https://api.github.com/users/jaymode/gists{/gist_id}","starred_url":"https://api.github.com/users/jaymode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaymode/subscriptions","organizations_url":"https://api.github.com/users/jaymode/orgs","repos_url":"https://api.github.com/users/jaymode/repos","events_url":"https://api.github.com/users/jaymode/events{/privacy}","received_events_url":"https://api.github.com/users/jaymode/received_events","type":"User","site_admin":false},"body":"I think this should be ```actionRequest.copyHeadersFrom(restRequest)``` ?","created_at":"2015-05-15T17:45:55Z","updated_at":"2015-05-15T17:45:55Z","html_url":"https://github.com/elastic/elasticsearch/pull/11060#discussion_r30429491","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/30429491"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11060#discussion_r30429491"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060","id":35017190,"html_url":"https://github.com/elastic/elasticsearch/pull/11060","diff_url":"https://github.com/elastic/elasticsearch/pull/11060.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/11060.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11060","number":11060,"state":"open","locked":false,"title":"Internal: Propagate headers & contexts to sub-requests","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":"Whenever a query parser (or any other component) issues another\r\nrequest as part of a request, the headers and the context has to\r\nbe supplied as well.\r\n\r\nIn order to do this, the `SearchContext` has to have those headers\r\navailable, which in turn means, the shard level request needs to\r\ncopy those from the original `SearchRequest`\r\n\r\nThis commit introduces two new interface to supply the needed methods\r\nto work with context and headers.\r\n\r\nTODO\r\n\r\n* Validate this approach\r\n* PercolateContext is pretty dumb right now and just implements the methods\r\n  without acting\r\n* Testing: Context testing is tricky, havent found a smart way so far\r\n\r\nCloses #10979","created_at":"2015-05-08T15:06:24Z","updated_at":"2015-05-15T17:45:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc3f4730de456c65b0ad532d2a9f3a0a571a1b63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/11060/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/2ff809718d16b1ab337dff05cba70ea253df2683","head":{"label":"spinscale:1505-issue-10979-searchcontext-must-have-request-context-and-headers","ref":"1505-issue-10979-searchcontext-must-have-request-context-and-headers","sha":"2ff809718d16b1ab337dff05cba70ea253df2683","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-05-15T16:18:09Z","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":108152,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"597c53a0bb36dafde0ffb17edb5792c1b5422f00","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-05-15T15:08:34Z","pushed_at":"2015-05-15T17:26:12Z","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":360548,"stargazers_count":11176,"watchers_count":11176,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3525,"mirror_url":null,"open_issues_count":1132,"forks":3525,"open_issues":1132,"watchers":11176,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/11060"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11060"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/11060/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/11060/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/2ff809718d16b1ab337dff05cba70ea253df2683"}}}}