{"action":"created","comment":{"url":"https://api.github.com/repos/raintank/metrictank/pulls/comments/86804206","pull_request_review_id":7443104,"id":86804206,"diff_hunk":"@@ -16,27 +17,37 @@ index=metrictank\n \n # show all matching documents, given a query\n function es_search () {\n-\tcurl \"http://localhost:9200/$index/metric_index/_search?q=$1&pretty=true\"\n+    size=${2:-20}\n+    curl -s \"http://localhost:9200/$index/metric_index/_search?q=$1&pretty=true&size=$size\"\n }\n \n # delete all matching documents, given a query\n function es_delete () {\n-        curl -X DELETE \"http://localhost:9200/$index/metric_index/_query?q=$1\"\n+    curl -s -X DELETE \"http://localhost:9200/$index/metric_index/_query?q=$1\"\n+}\n+\n+# list series matching a graphite pattern\n+function es_list () {\n+    es_search $(es_query $1) 10000 | grep name | sed -e 's/^.*: \"\\|\",$//g'\n }\n \n # construct a query, given a graphite pattern\n # e.g. so*.*.and.so -> nodes.n0:so*+AND+nodes.n2:and+AND+nodes.n3:so\n # caveats:\n-# - foo.*.* will also match foo or foo.* or foo.*.*.* since we don't have a check yet for number of fields\n # - does not support {foo,bar} or [this,kindof] graphite syntax! just literal words and wildcards.\n function es_query () {\n     local q\n     IFS='.' read -ra nodes <<< \"$1\"\n     for i in \"${!nodes[@]}\"; do\n-        [ \"${nodes[$i]}\" == '*' ] && continue\n-        new=\"nodes.n$i:${nodes[$i]}\"\n-        [ -n \"$q\" ] && q=\"$q+AND+\"\n+        if [ \"${nodes[$i]}\" == '*' ]; then\n+            new=\"%2B_exists_:nodes.n$i\"\n+        else\n+            new=\"%2Bnodes.n$i:%22${nodes[$i]}%22\"\n+        fi\n+        [ -n \"$q\" ] && q=\"$q+\"\n         q=\"$q$new\"\n     done\n+    i=$(expr $i + 1)\n+    q=\"$q+-_exists_:nodes.n$i\"","path":"contrib/maintenance-es-index.sh","position":56,"original_position":56,"commit_id":"861169e8a48e3a70b46d0757ca7b573889267303","original_commit_id":"861169e8a48e3a70b46d0757ca7b573889267303","user":{"login":"DanCech","id":1443603,"avatar_url":"https://avatars.githubusercontent.com/u/1443603?v=3","gravatar_id":"","url":"https://api.github.com/users/DanCech","html_url":"https://github.com/DanCech","followers_url":"https://api.github.com/users/DanCech/followers","following_url":"https://api.github.com/users/DanCech/following{/other_user}","gists_url":"https://api.github.com/users/DanCech/gists{/gist_id}","starred_url":"https://api.github.com/users/DanCech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanCech/subscriptions","organizations_url":"https://api.github.com/users/DanCech/orgs","repos_url":"https://api.github.com/users/DanCech/repos","events_url":"https://api.github.com/users/DanCech/events{/privacy}","received_events_url":"https://api.github.com/users/DanCech/received_events","type":"User","site_admin":false},"body":"Yeah, that was the idea.","created_at":"2016-11-07T15:55:38Z","updated_at":"2016-11-07T15:55:38Z","html_url":"https://github.com/raintank/metrictank/pull/371#discussion_r86804206","pull_request_url":"https://api.github.com/repos/raintank/metrictank/pulls/371","_links":{"self":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/comments/86804206"},"html":{"href":"https://github.com/raintank/metrictank/pull/371#discussion_r86804206"},"pull_request":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/371"}}},"pull_request":{"url":"https://api.github.com/repos/raintank/metrictank/pulls/371","id":92364073,"html_url":"https://github.com/raintank/metrictank/pull/371","diff_url":"https://github.com/raintank/metrictank/pull/371.diff","patch_url":"https://github.com/raintank/metrictank/pull/371.patch","issue_url":"https://api.github.com/repos/raintank/metrictank/issues/371","number":371,"state":"open","locked":false,"title":"added es_list function, made graphite wildcards match exactly","user":{"login":"DanCech","id":1443603,"avatar_url":"https://avatars.githubusercontent.com/u/1443603?v=3","gravatar_id":"","url":"https://api.github.com/users/DanCech","html_url":"https://github.com/DanCech","followers_url":"https://api.github.com/users/DanCech/followers","following_url":"https://api.github.com/users/DanCech/following{/other_user}","gists_url":"https://api.github.com/users/DanCech/gists{/gist_id}","starred_url":"https://api.github.com/users/DanCech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanCech/subscriptions","organizations_url":"https://api.github.com/users/DanCech/orgs","repos_url":"https://api.github.com/users/DanCech/repos","events_url":"https://api.github.com/users/DanCech/events{/privacy}","received_events_url":"https://api.github.com/users/DanCech/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-04T15:44:13Z","updated_at":"2016-11-07T15:55:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24555eda29fdd176c5e5a39cb5b116ab497b4805","assignee":{"login":"Dieterbe","id":20774,"avatar_url":"https://avatars.githubusercontent.com/u/20774?v=3","gravatar_id":"","url":"https://api.github.com/users/Dieterbe","html_url":"https://github.com/Dieterbe","followers_url":"https://api.github.com/users/Dieterbe/followers","following_url":"https://api.github.com/users/Dieterbe/following{/other_user}","gists_url":"https://api.github.com/users/Dieterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/Dieterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dieterbe/subscriptions","organizations_url":"https://api.github.com/users/Dieterbe/orgs","repos_url":"https://api.github.com/users/Dieterbe/repos","events_url":"https://api.github.com/users/Dieterbe/events{/privacy}","received_events_url":"https://api.github.com/users/Dieterbe/received_events","type":"User","site_admin":false},"assignees":[{"login":"Dieterbe","id":20774,"avatar_url":"https://avatars.githubusercontent.com/u/20774?v=3","gravatar_id":"","url":"https://api.github.com/users/Dieterbe","html_url":"https://github.com/Dieterbe","followers_url":"https://api.github.com/users/Dieterbe/followers","following_url":"https://api.github.com/users/Dieterbe/following{/other_user}","gists_url":"https://api.github.com/users/Dieterbe/gists{/gist_id}","starred_url":"https://api.github.com/users/Dieterbe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dieterbe/subscriptions","organizations_url":"https://api.github.com/users/Dieterbe/orgs","repos_url":"https://api.github.com/users/Dieterbe/repos","events_url":"https://api.github.com/users/Dieterbe/events{/privacy}","received_events_url":"https://api.github.com/users/Dieterbe/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/raintank/metrictank/pulls/371/commits","review_comments_url":"https://api.github.com/repos/raintank/metrictank/pulls/371/comments","review_comment_url":"https://api.github.com/repos/raintank/metrictank/pulls/comments{/number}","comments_url":"https://api.github.com/repos/raintank/metrictank/issues/371/comments","statuses_url":"https://api.github.com/repos/raintank/metrictank/statuses/861169e8a48e3a70b46d0757ca7b573889267303","head":{"label":"raintank:maint-script","ref":"maint-script","sha":"861169e8a48e3a70b46d0757ca7b573889267303","user":{"login":"raintank","id":8512431,"avatar_url":"https://avatars.githubusercontent.com/u/8512431?v=3","gravatar_id":"","url":"https://api.github.com/users/raintank","html_url":"https://github.com/raintank","followers_url":"https://api.github.com/users/raintank/followers","following_url":"https://api.github.com/users/raintank/following{/other_user}","gists_url":"https://api.github.com/users/raintank/gists{/gist_id}","starred_url":"https://api.github.com/users/raintank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raintank/subscriptions","organizations_url":"https://api.github.com/users/raintank/orgs","repos_url":"https://api.github.com/users/raintank/repos","events_url":"https://api.github.com/users/raintank/events{/privacy}","received_events_url":"https://api.github.com/users/raintank/received_events","type":"Organization","site_admin":false},"repo":{"id":30401116,"name":"metrictank","full_name":"raintank/metrictank","owner":{"login":"raintank","id":8512431,"avatar_url":"https://avatars.githubusercontent.com/u/8512431?v=3","gravatar_id":"","url":"https://api.github.com/users/raintank","html_url":"https://github.com/raintank","followers_url":"https://api.github.com/users/raintank/followers","following_url":"https://api.github.com/users/raintank/following{/other_user}","gists_url":"https://api.github.com/users/raintank/gists{/gist_id}","starred_url":"https://api.github.com/users/raintank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raintank/subscriptions","organizations_url":"https://api.github.com/users/raintank/orgs","repos_url":"https://api.github.com/users/raintank/repos","events_url":"https://api.github.com/users/raintank/events{/privacy}","received_events_url":"https://api.github.com/users/raintank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raintank/metrictank","description":"Cassandra-backed, metrics2.0 based, multi-tenant timeseries database for Graphite and friends","fork":false,"url":"https://api.github.com/repos/raintank/metrictank","forks_url":"https://api.github.com/repos/raintank/metrictank/forks","keys_url":"https://api.github.com/repos/raintank/metrictank/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raintank/metrictank/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raintank/metrictank/teams","hooks_url":"https://api.github.com/repos/raintank/metrictank/hooks","issue_events_url":"https://api.github.com/repos/raintank/metrictank/issues/events{/number}","events_url":"https://api.github.com/repos/raintank/metrictank/events","assignees_url":"https://api.github.com/repos/raintank/metrictank/assignees{/user}","branches_url":"https://api.github.com/repos/raintank/metrictank/branches{/branch}","tags_url":"https://api.github.com/repos/raintank/metrictank/tags","blobs_url":"https://api.github.com/repos/raintank/metrictank/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raintank/metrictank/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raintank/metrictank/git/refs{/sha}","trees_url":"https://api.github.com/repos/raintank/metrictank/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raintank/metrictank/statuses/{sha}","languages_url":"https://api.github.com/repos/raintank/metrictank/languages","stargazers_url":"https://api.github.com/repos/raintank/metrictank/stargazers","contributors_url":"https://api.github.com/repos/raintank/metrictank/contributors","subscribers_url":"https://api.github.com/repos/raintank/metrictank/subscribers","subscription_url":"https://api.github.com/repos/raintank/metrictank/subscription","commits_url":"https://api.github.com/repos/raintank/metrictank/commits{/sha}","git_commits_url":"https://api.github.com/repos/raintank/metrictank/git/commits{/sha}","comments_url":"https://api.github.com/repos/raintank/metrictank/comments{/number}","issue_comment_url":"https://api.github.com/repos/raintank/metrictank/issues/comments{/number}","contents_url":"https://api.github.com/repos/raintank/metrictank/contents/{+path}","compare_url":"https://api.github.com/repos/raintank/metrictank/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raintank/metrictank/merges","archive_url":"https://api.github.com/repos/raintank/metrictank/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raintank/metrictank/downloads","issues_url":"https://api.github.com/repos/raintank/metrictank/issues{/number}","pulls_url":"https://api.github.com/repos/raintank/metrictank/pulls{/number}","milestones_url":"https://api.github.com/repos/raintank/metrictank/milestones{/number}","notifications_url":"https://api.github.com/repos/raintank/metrictank/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raintank/metrictank/labels{/name}","releases_url":"https://api.github.com/repos/raintank/metrictank/releases{/id}","deployments_url":"https://api.github.com/repos/raintank/metrictank/deployments","created_at":"2015-02-06T07:44:12Z","updated_at":"2016-11-02T08:43:30Z","pushed_at":"2016-11-07T14:56:10Z","git_url":"git://github.com/raintank/metrictank.git","ssh_url":"git@github.com:raintank/metrictank.git","clone_url":"https://github.com/raintank/metrictank.git","svn_url":"https://github.com/raintank/metrictank","homepage":"","size":9149,"stargazers_count":69,"watchers_count":69,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":68,"forks":10,"open_issues":68,"watchers":69,"default_branch":"master"}},"base":{"label":"raintank:master","ref":"master","sha":"653abad88c808b9daa09f3fb220fd6cbd93dc235","user":{"login":"raintank","id":8512431,"avatar_url":"https://avatars.githubusercontent.com/u/8512431?v=3","gravatar_id":"","url":"https://api.github.com/users/raintank","html_url":"https://github.com/raintank","followers_url":"https://api.github.com/users/raintank/followers","following_url":"https://api.github.com/users/raintank/following{/other_user}","gists_url":"https://api.github.com/users/raintank/gists{/gist_id}","starred_url":"https://api.github.com/users/raintank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raintank/subscriptions","organizations_url":"https://api.github.com/users/raintank/orgs","repos_url":"https://api.github.com/users/raintank/repos","events_url":"https://api.github.com/users/raintank/events{/privacy}","received_events_url":"https://api.github.com/users/raintank/received_events","type":"Organization","site_admin":false},"repo":{"id":30401116,"name":"metrictank","full_name":"raintank/metrictank","owner":{"login":"raintank","id":8512431,"avatar_url":"https://avatars.githubusercontent.com/u/8512431?v=3","gravatar_id":"","url":"https://api.github.com/users/raintank","html_url":"https://github.com/raintank","followers_url":"https://api.github.com/users/raintank/followers","following_url":"https://api.github.com/users/raintank/following{/other_user}","gists_url":"https://api.github.com/users/raintank/gists{/gist_id}","starred_url":"https://api.github.com/users/raintank/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raintank/subscriptions","organizations_url":"https://api.github.com/users/raintank/orgs","repos_url":"https://api.github.com/users/raintank/repos","events_url":"https://api.github.com/users/raintank/events{/privacy}","received_events_url":"https://api.github.com/users/raintank/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/raintank/metrictank","description":"Cassandra-backed, metrics2.0 based, multi-tenant timeseries database for Graphite and friends","fork":false,"url":"https://api.github.com/repos/raintank/metrictank","forks_url":"https://api.github.com/repos/raintank/metrictank/forks","keys_url":"https://api.github.com/repos/raintank/metrictank/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raintank/metrictank/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raintank/metrictank/teams","hooks_url":"https://api.github.com/repos/raintank/metrictank/hooks","issue_events_url":"https://api.github.com/repos/raintank/metrictank/issues/events{/number}","events_url":"https://api.github.com/repos/raintank/metrictank/events","assignees_url":"https://api.github.com/repos/raintank/metrictank/assignees{/user}","branches_url":"https://api.github.com/repos/raintank/metrictank/branches{/branch}","tags_url":"https://api.github.com/repos/raintank/metrictank/tags","blobs_url":"https://api.github.com/repos/raintank/metrictank/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raintank/metrictank/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raintank/metrictank/git/refs{/sha}","trees_url":"https://api.github.com/repos/raintank/metrictank/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raintank/metrictank/statuses/{sha}","languages_url":"https://api.github.com/repos/raintank/metrictank/languages","stargazers_url":"https://api.github.com/repos/raintank/metrictank/stargazers","contributors_url":"https://api.github.com/repos/raintank/metrictank/contributors","subscribers_url":"https://api.github.com/repos/raintank/metrictank/subscribers","subscription_url":"https://api.github.com/repos/raintank/metrictank/subscription","commits_url":"https://api.github.com/repos/raintank/metrictank/commits{/sha}","git_commits_url":"https://api.github.com/repos/raintank/metrictank/git/commits{/sha}","comments_url":"https://api.github.com/repos/raintank/metrictank/comments{/number}","issue_comment_url":"https://api.github.com/repos/raintank/metrictank/issues/comments{/number}","contents_url":"https://api.github.com/repos/raintank/metrictank/contents/{+path}","compare_url":"https://api.github.com/repos/raintank/metrictank/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raintank/metrictank/merges","archive_url":"https://api.github.com/repos/raintank/metrictank/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raintank/metrictank/downloads","issues_url":"https://api.github.com/repos/raintank/metrictank/issues{/number}","pulls_url":"https://api.github.com/repos/raintank/metrictank/pulls{/number}","milestones_url":"https://api.github.com/repos/raintank/metrictank/milestones{/number}","notifications_url":"https://api.github.com/repos/raintank/metrictank/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raintank/metrictank/labels{/name}","releases_url":"https://api.github.com/repos/raintank/metrictank/releases{/id}","deployments_url":"https://api.github.com/repos/raintank/metrictank/deployments","created_at":"2015-02-06T07:44:12Z","updated_at":"2016-11-02T08:43:30Z","pushed_at":"2016-11-07T14:56:10Z","git_url":"git://github.com/raintank/metrictank.git","ssh_url":"git@github.com:raintank/metrictank.git","clone_url":"https://github.com/raintank/metrictank.git","svn_url":"https://github.com/raintank/metrictank","homepage":"","size":9149,"stargazers_count":69,"watchers_count":69,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":68,"forks":10,"open_issues":68,"watchers":69,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/371"},"html":{"href":"https://github.com/raintank/metrictank/pull/371"},"issue":{"href":"https://api.github.com/repos/raintank/metrictank/issues/371"},"comments":{"href":"https://api.github.com/repos/raintank/metrictank/issues/371/comments"},"review_comments":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/371/comments"},"review_comment":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/raintank/metrictank/pulls/371/commits"},"statuses":{"href":"https://api.github.com/repos/raintank/metrictank/statuses/861169e8a48e3a70b46d0757ca7b573889267303"}}}}
{"actor":{"display_login":"DanCech"}}