{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/kibana/pulls/comments/94139521","pull_request_review_id":14669976,"id":94139521,"diff_hunk":"@@ -0,0 +1,133 @@\n+import elasticsearch from 'elasticsearch';\n+import { get, set, isEmpty, cloneDeep, pick } from 'lodash';\n+import toPath from 'lodash/internal/toPath';\n+import Boom from 'boom';\n+\n+import filterHeaders from './filter_headers';\n+import { parseConfig } from './parse_config';\n+\n+export default class Cluster {\n+  constructor(config) {\n+    this._config = Object.assign({}, config);\n+    this.errors = elasticsearch.errors;\n+\n+    this._client = this.createClient();\n+    this._noAuthClient = this.createClient({ auth: false });\n+\n+    return this;\n+  }\n+\n+  /**\n+   * callWithRequest","path":"src/core_plugins/elasticsearch/lib/cluster.js","position":21,"original_position":21,"commit_id":"08cb58cffa3b683c9ef72b25e6c03f12136cc5a9","original_commit_id":"ec854cfcac12d27363060b1fa21bb6427518b8d8","user":{"login":"Stacey-Gammon","id":16563603,"avatar_url":"https://avatars.githubusercontent.com/u/16563603?v=3","gravatar_id":"","url":"https://api.github.com/users/Stacey-Gammon","html_url":"https://github.com/Stacey-Gammon","followers_url":"https://api.github.com/users/Stacey-Gammon/followers","following_url":"https://api.github.com/users/Stacey-Gammon/following{/other_user}","gists_url":"https://api.github.com/users/Stacey-Gammon/gists{/gist_id}","starred_url":"https://api.github.com/users/Stacey-Gammon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stacey-Gammon/subscriptions","organizations_url":"https://api.github.com/users/Stacey-Gammon/orgs","repos_url":"https://api.github.com/users/Stacey-Gammon/repos","events_url":"https://api.github.com/users/Stacey-Gammon/events{/privacy}","received_events_url":"https://api.github.com/users/Stacey-Gammon/received_events","type":"User","site_admin":false},"body":"Whatever you decide is fine, but personally I love the argument specifications. :)  I just don't like repeating the name of the function.  I like it when input parameter types are explicitly defined because I find it difficult to discover since js is not strongly typed.  Additionally you can get some visual indication (depending on your IDE) that you are doing something wrong if you pass in a type that isn't expected.","created_at":"2016-12-29T14:14:18Z","updated_at":"2016-12-29T14:23:23Z","html_url":"https://github.com/elastic/kibana/pull/9132#discussion_r94139521","pull_request_url":"https://api.github.com/repos/elastic/kibana/pulls/9132","_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments/94139521"},"html":{"href":"https://github.com/elastic/kibana/pull/9132#discussion_r94139521"},"pull_request":{"href":"https://api.github.com/repos/elastic/kibana/pulls/9132"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/9132","id":94265429,"html_url":"https://github.com/elastic/kibana/pull/9132","diff_url":"https://github.com/elastic/kibana/pull/9132.diff","patch_url":"https://github.com/elastic/kibana/pull/9132.patch","issue_url":"https://api.github.com/repos/elastic/kibana/issues/9132","number":9132,"state":"open","locked":false,"title":"Tribe node support","user":{"login":"tylersmalley","id":40265,"avatar_url":"https://avatars.githubusercontent.com/u/40265?v=3","gravatar_id":"","url":"https://api.github.com/users/tylersmalley","html_url":"https://github.com/tylersmalley","followers_url":"https://api.github.com/users/tylersmalley/followers","following_url":"https://api.github.com/users/tylersmalley/following{/other_user}","gists_url":"https://api.github.com/users/tylersmalley/gists{/gist_id}","starred_url":"https://api.github.com/users/tylersmalley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tylersmalley/subscriptions","organizations_url":"https://api.github.com/users/tylersmalley/orgs","repos_url":"https://api.github.com/users/tylersmalley/repos","events_url":"https://api.github.com/users/tylersmalley/events{/privacy}","received_events_url":"https://api.github.com/users/tylersmalley/received_events","type":"User","site_admin":false},"body":"This PR adds support for configuring Kibana to pull data from a tribe node.  At a high level, this works by pointing kibana to an administration node for managing state and a tribe node for data.\r\n\r\n## Changes\r\n### Server API\r\nPreviously we exposed the Elasticsearch connection on the Hapi plugin (`client`, `ElasticsearchClientLogging`, `createClient`, `callWithRequestFactory`, `callWithRequest`). \r\n\r\nThe Elasticsearch plugin now exposes `getCluster` and `createCluster` on `server.plugins.elasticsearch`. `getCluster` returns a cluster object containing `config()`, `createClient`, `callWithRequest` and `callWithInternalUser`.\r\n\r\nThere are two cluster's already created.  'admin' for any kibana state changes(modifying .kibana, etc), and 'data' for all other requests.  If a tribe node is configured, 'admin' points to `elasticsearch.url`, and 'data' points to `elasticsearch.tribe.url`.  If a tribe node is not configured, both point to `elasticsearch.url`\r\n\r\nAn example of making an admin request as the configured server user in kibana.yml:\r\n```\r\nconst { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin')\r\ncallWithInternalUser('bulk', options)\r\n```\r\n\r\nAnd a non kibana state change passing through the current request:\r\n```\r\nconst { callWithRequest } = server.plugins.elasticsearch.getCluster('data')\r\ncallWithRequest(req, 'bulk', options)\r\n```\r\n\r\n### Browser API\r\nKibana state management requests in the browser will need to use the `esAdmin` angular service, or to use the `/es_admin` proxy endpoint.  All other requests can continue to use the `es` service and `/elasticsearch` proxy endpoint.\r\n\r\n## Testing\r\nQuick start:\r\n* `./node_modules/.bin/grunt esvm:tribe:keepalive` will start several nodes\r\n  * localhost:9200 tribe node, points to cluster 1 and 2\r\n  * localhost:9201 data cluster 1\r\n  * localhost:9202 data cluster 2\r\n  * localhost:9203 administration\r\n* In kibana.yml: \r\n  ```\r\n  elasticsearch.tribe.url: \"http://localhost:9203\"\r\n  ```\r\n\r\nCloses #8495","created_at":"2016-11-17T22:33:08Z","updated_at":"2016-12-29T14:23:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9ee1dcd88b7734caf56b7296a16abeb684e5a42","assignee":{"login":"epixa","id":53814,"avatar_url":"https://avatars.githubusercontent.com/u/53814?v=3","gravatar_id":"","url":"https://api.github.com/users/epixa","html_url":"https://github.com/epixa","followers_url":"https://api.github.com/users/epixa/followers","following_url":"https://api.github.com/users/epixa/following{/other_user}","gists_url":"https://api.github.com/users/epixa/gists{/gist_id}","starred_url":"https://api.github.com/users/epixa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epixa/subscriptions","organizations_url":"https://api.github.com/users/epixa/orgs","repos_url":"https://api.github.com/users/epixa/repos","events_url":"https://api.github.com/users/epixa/events{/privacy}","received_events_url":"https://api.github.com/users/epixa/received_events","type":"User","site_admin":false},"assignees":[{"login":"epixa","id":53814,"avatar_url":"https://avatars.githubusercontent.com/u/53814?v=3","gravatar_id":"","url":"https://api.github.com/users/epixa","html_url":"https://github.com/epixa","followers_url":"https://api.github.com/users/epixa/followers","following_url":"https://api.github.com/users/epixa/following{/other_user}","gists_url":"https://api.github.com/users/epixa/gists{/gist_id}","starred_url":"https://api.github.com/users/epixa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epixa/subscriptions","organizations_url":"https://api.github.com/users/epixa/orgs","repos_url":"https://api.github.com/users/epixa/repos","events_url":"https://api.github.com/users/epixa/events{/privacy}","received_events_url":"https://api.github.com/users/epixa/received_events","type":"User","site_admin":false},{"login":"spalger","id":1329312,"avatar_url":"https://avatars.githubusercontent.com/u/1329312?v=3","gravatar_id":"","url":"https://api.github.com/users/spalger","html_url":"https://github.com/spalger","followers_url":"https://api.github.com/users/spalger/followers","following_url":"https://api.github.com/users/spalger/following{/other_user}","gists_url":"https://api.github.com/users/spalger/gists{/gist_id}","starred_url":"https://api.github.com/users/spalger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spalger/subscriptions","organizations_url":"https://api.github.com/users/spalger/orgs","repos_url":"https://api.github.com/users/spalger/repos","events_url":"https://api.github.com/users/spalger/events{/privacy}","received_events_url":"https://api.github.com/users/spalger/received_events","type":"User","site_admin":false},{"login":"Stacey-Gammon","id":16563603,"avatar_url":"https://avatars.githubusercontent.com/u/16563603?v=3","gravatar_id":"","url":"https://api.github.com/users/Stacey-Gammon","html_url":"https://github.com/Stacey-Gammon","followers_url":"https://api.github.com/users/Stacey-Gammon/followers","following_url":"https://api.github.com/users/Stacey-Gammon/following{/other_user}","gists_url":"https://api.github.com/users/Stacey-Gammon/gists{/gist_id}","starred_url":"https://api.github.com/users/Stacey-Gammon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stacey-Gammon/subscriptions","organizations_url":"https://api.github.com/users/Stacey-Gammon/orgs","repos_url":"https://api.github.com/users/Stacey-Gammon/repos","events_url":"https://api.github.com/users/Stacey-Gammon/events{/privacy}","received_events_url":"https://api.github.com/users/Stacey-Gammon/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/elastic/kibana/pulls/9132/commits","review_comments_url":"https://api.github.com/repos/elastic/kibana/pulls/9132/comments","review_comment_url":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/9132/comments","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/08cb58cffa3b683c9ef72b25e6c03f12136cc5a9","head":{"label":"elastic:tribe-node-support","ref":"tribe-node-support","sha":"08cb58cffa3b683c9ef72b25e6c03f12136cc5a9","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":7833168,"name":"kibana","full_name":"elastic/kibana","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/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":false,"url":"https://api.github.com/repos/elastic/kibana","forks_url":"https://api.github.com/repos/elastic/kibana/forks","keys_url":"https://api.github.com/repos/elastic/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/kibana/teams","hooks_url":"https://api.github.com/repos/elastic/kibana/hooks","issue_events_url":"https://api.github.com/repos/elastic/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/kibana/events","assignees_url":"https://api.github.com/repos/elastic/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/kibana/tags","blobs_url":"https://api.github.com/repos/elastic/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/kibana/languages","stargazers_url":"https://api.github.com/repos/elastic/kibana/stargazers","contributors_url":"https://api.github.com/repos/elastic/kibana/contributors","subscribers_url":"https://api.github.com/repos/elastic/kibana/subscribers","subscription_url":"https://api.github.com/repos/elastic/kibana/subscription","commits_url":"https://api.github.com/repos/elastic/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/kibana/merges","archive_url":"https://api.github.com/repos/elastic/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/kibana/downloads","issues_url":"https://api.github.com/repos/elastic/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/kibana/labels{/name}","releases_url":"https://api.github.com/repos/elastic/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/kibana/deployments","created_at":"2013-01-26T04:00:59Z","updated_at":"2016-12-29T07:40:59Z","pushed_at":"2016-12-29T00:13:47Z","git_url":"git://github.com/elastic/kibana.git","ssh_url":"git@github.com:elastic/kibana.git","clone_url":"https://github.com/elastic/kibana.git","svn_url":"https://github.com/elastic/kibana","homepage":"https://www.elastic.co/products/kibana","size":223550,"stargazers_count":6540,"watchers_count":6540,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2436,"mirror_url":null,"open_issues_count":1335,"forks":2436,"open_issues":1335,"watchers":6540,"default_branch":"master"}},"base":{"label":"elastic:master","ref":"master","sha":"b6969f537e46eb00c56954c827e302825c86df2f","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":7833168,"name":"kibana","full_name":"elastic/kibana","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/kibana","description":":bar_chart: Kibana analytics and search dashboard for Elasticsearch","fork":false,"url":"https://api.github.com/repos/elastic/kibana","forks_url":"https://api.github.com/repos/elastic/kibana/forks","keys_url":"https://api.github.com/repos/elastic/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/kibana/teams","hooks_url":"https://api.github.com/repos/elastic/kibana/hooks","issue_events_url":"https://api.github.com/repos/elastic/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/kibana/events","assignees_url":"https://api.github.com/repos/elastic/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/kibana/tags","blobs_url":"https://api.github.com/repos/elastic/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/kibana/languages","stargazers_url":"https://api.github.com/repos/elastic/kibana/stargazers","contributors_url":"https://api.github.com/repos/elastic/kibana/contributors","subscribers_url":"https://api.github.com/repos/elastic/kibana/subscribers","subscription_url":"https://api.github.com/repos/elastic/kibana/subscription","commits_url":"https://api.github.com/repos/elastic/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/kibana/merges","archive_url":"https://api.github.com/repos/elastic/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/kibana/downloads","issues_url":"https://api.github.com/repos/elastic/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/kibana/labels{/name}","releases_url":"https://api.github.com/repos/elastic/kibana/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/kibana/deployments","created_at":"2013-01-26T04:00:59Z","updated_at":"2016-12-29T07:40:59Z","pushed_at":"2016-12-29T00:13:47Z","git_url":"git://github.com/elastic/kibana.git","ssh_url":"git@github.com:elastic/kibana.git","clone_url":"https://github.com/elastic/kibana.git","svn_url":"https://github.com/elastic/kibana","homepage":"https://www.elastic.co/products/kibana","size":223550,"stargazers_count":6540,"watchers_count":6540,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2436,"mirror_url":null,"open_issues_count":1335,"forks":2436,"open_issues":1335,"watchers":6540,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/9132"},"html":{"href":"https://github.com/elastic/kibana/pull/9132"},"issue":{"href":"https://api.github.com/repos/elastic/kibana/issues/9132"},"comments":{"href":"https://api.github.com/repos/elastic/kibana/issues/9132/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/kibana/pulls/9132/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/kibana/pulls/9132/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/kibana/statuses/08cb58cffa3b683c9ef72b25e6c03f12136cc5a9"}}}}
{"actor":{"display_login":"Stacey-Gammon"}}