{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/kibana/pulls/comments/44863776","id":44863776,"diff_hunk":"@@ -0,0 +1,4 @@\n+{\n+  \"name\": \"api\",","path":"src/plugins/api/package.json","position":2,"original_position":2,"commit_id":"4f3893a11349a841b4d1e33eda8c44fb914e34e7","original_commit_id":"4f3893a11349a841b4d1e33eda8c44fb914e34e7","user":{"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},"body":"I think `api` might be a bit generic 😉","created_at":"2015-11-14T21:15:42Z","updated_at":"2015-11-14T21:15:42Z","html_url":"https://github.com/elastic/kibana/pull/5213#discussion_r44863776","pull_request_url":"https://api.github.com/repos/elastic/kibana/pulls/5213","_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments/44863776"},"html":{"href":"https://github.com/elastic/kibana/pull/5213#discussion_r44863776"},"pull_request":{"href":"https://api.github.com/repos/elastic/kibana/pulls/5213"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/kibana/pulls/5213","id":48945275,"html_url":"https://github.com/elastic/kibana/pull/5213","diff_url":"https://github.com/elastic/kibana/pull/5213.diff","patch_url":"https://github.com/elastic/kibana/pull/5213.patch","issue_url":"https://api.github.com/repos/elastic/kibana/issues/5213","number":5213,"state":"open","locked":false,"title":"Create an Index Pattern API","user":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"body":"Closes #5199\r\n\r\n**This PR is a work in progress**\r\n\r\n### Todo\r\n\r\n* Testing\r\n\r\nPrimarily going to rely on functional tests for API testing, do unit testing where appropriate. \r\n\r\n* Security\r\n\r\nShould accept API tokens for auth once #5267 is merged.\r\nUntil then, how should we secure this? It's a bit different than most ways we access elasticsearch right now because it accesses the .kibana index, but it will be initiated from the frontend. Should look at how the current pattern creation screen does it with a shielded cluster.\r\n\r\n* Payload validation?\r\nCreate a Joi schema\r\n\r\n### Done\r\n\r\n* Moved API endpoints into a plugin.\r\n* Implemented basic initial version of all the endpoints.\r\n* Error handling \r\nNeed to handle errors that the elasticsearch client might throw at me\r\nhttps://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/errors.html\r\n* Create an elasticsearch index template when an index pattern is created\r\n* Ignore type specific mappings, use [default](https://www.elastic.co/guide/en/elasticsearch/reference/master/default-mapping.html)\r\n  * Accept json payload that ES expects for mappings. \r\n  * If a pattern matches no existing indices, a template will be created.\r\n  * If a pattern matches existing indices, a template will not be created.\r\n  * If a user is trying to update an existing pattern with a matching template, we should only accept new field mappings and reject changes to existing ones (add a warning in the UI that uses this API to describe this behavior?) (going to punt on this until we feel like we actually need it because it's going to be rather complicated).","created_at":"2015-10-27T23:07:52Z","updated_at":"2015-11-14T21:15:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f6f67b414a930b0cccf6a756d0cbdb41833a67fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/kibana/pulls/5213/commits","review_comments_url":"https://api.github.com/repos/elastic/kibana/pulls/5213/comments","review_comment_url":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/kibana/issues/5213/comments","statuses_url":"https://api.github.com/repos/elastic/kibana/statuses/4f3893a11349a841b4d1e33eda8c44fb914e34e7","head":{"label":"Bargs:indexPatternApi","ref":"indexPatternApi","sha":"4f3893a11349a841b4d1e33eda8c44fb914e34e7","user":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"repo":{"id":42202308,"name":"kibana","full_name":"Bargs/kibana","owner":{"login":"Bargs","id":6239176,"avatar_url":"https://avatars.githubusercontent.com/u/6239176?v=3","gravatar_id":"","url":"https://api.github.com/users/Bargs","html_url":"https://github.com/Bargs","followers_url":"https://api.github.com/users/Bargs/followers","following_url":"https://api.github.com/users/Bargs/following{/other_user}","gists_url":"https://api.github.com/users/Bargs/gists{/gist_id}","starred_url":"https://api.github.com/users/Bargs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bargs/subscriptions","organizations_url":"https://api.github.com/users/Bargs/orgs","repos_url":"https://api.github.com/users/Bargs/repos","events_url":"https://api.github.com/users/Bargs/events{/privacy}","received_events_url":"https://api.github.com/users/Bargs/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Bargs/kibana","description":"Kibana","fork":true,"url":"https://api.github.com/repos/Bargs/kibana","forks_url":"https://api.github.com/repos/Bargs/kibana/forks","keys_url":"https://api.github.com/repos/Bargs/kibana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Bargs/kibana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Bargs/kibana/teams","hooks_url":"https://api.github.com/repos/Bargs/kibana/hooks","issue_events_url":"https://api.github.com/repos/Bargs/kibana/issues/events{/number}","events_url":"https://api.github.com/repos/Bargs/kibana/events","assignees_url":"https://api.github.com/repos/Bargs/kibana/assignees{/user}","branches_url":"https://api.github.com/repos/Bargs/kibana/branches{/branch}","tags_url":"https://api.github.com/repos/Bargs/kibana/tags","blobs_url":"https://api.github.com/repos/Bargs/kibana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Bargs/kibana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Bargs/kibana/git/refs{/sha}","trees_url":"https://api.github.com/repos/Bargs/kibana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Bargs/kibana/statuses/{sha}","languages_url":"https://api.github.com/repos/Bargs/kibana/languages","stargazers_url":"https://api.github.com/repos/Bargs/kibana/stargazers","contributors_url":"https://api.github.com/repos/Bargs/kibana/contributors","subscribers_url":"https://api.github.com/repos/Bargs/kibana/subscribers","subscription_url":"https://api.github.com/repos/Bargs/kibana/subscription","commits_url":"https://api.github.com/repos/Bargs/kibana/commits{/sha}","git_commits_url":"https://api.github.com/repos/Bargs/kibana/git/commits{/sha}","comments_url":"https://api.github.com/repos/Bargs/kibana/comments{/number}","issue_comment_url":"https://api.github.com/repos/Bargs/kibana/issues/comments{/number}","contents_url":"https://api.github.com/repos/Bargs/kibana/contents/{+path}","compare_url":"https://api.github.com/repos/Bargs/kibana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Bargs/kibana/merges","archive_url":"https://api.github.com/repos/Bargs/kibana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Bargs/kibana/downloads","issues_url":"https://api.github.com/repos/Bargs/kibana/issues{/number}","pulls_url":"https://api.github.com/repos/Bargs/kibana/pulls{/number}","milestones_url":"https://api.github.com/repos/Bargs/kibana/milestones{/number}","notifications_url":"https://api.github.com/repos/Bargs/kibana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Bargs/kibana/labels{/name}","releases_url":"https://api.github.com/repos/Bargs/kibana/releases{/id}","created_at":"2015-09-09T20:17:45Z","updated_at":"2015-09-09T20:17:48Z","pushed_at":"2015-11-14T01:34:18Z","git_url":"git://github.com/Bargs/kibana.git","ssh_url":"git@github.com:Bargs/kibana.git","clone_url":"https://github.com/Bargs/kibana.git","svn_url":"https://github.com/Bargs/kibana","homepage":"https://www.elastic.co/products/kibana","size":64429,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"f8e2b7442f2ee861d97345d62b5964f50185b550","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":"Kibana","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}","created_at":"2013-01-26T04:00:59Z","updated_at":"2015-11-14T13:27:34Z","pushed_at":"2015-11-14T18:36:34Z","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":98856,"stargazers_count":4429,"watchers_count":4429,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1633,"mirror_url":null,"open_issues_count":717,"forks":1633,"open_issues":717,"watchers":4429,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/kibana/pulls/5213"},"html":{"href":"https://github.com/elastic/kibana/pull/5213"},"issue":{"href":"https://api.github.com/repos/elastic/kibana/issues/5213"},"comments":{"href":"https://api.github.com/repos/elastic/kibana/issues/5213/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/kibana/pulls/5213/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/kibana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/kibana/pulls/5213/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/kibana/statuses/4f3893a11349a841b4d1e33eda8c44fb914e34e7"}}}}