{"action":"created","comment":{"url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/comments/43933010","id":43933010,"diff_hunk":"@@ -104,16 +101,46 @@ provided must evaluate to true. You can apply as many groups of conditions as yo\n You could call `append` as follows:\n \n ```\n-var secureSearch = builder.append(filter1, filter2).append(filter3).toSearch()\n+var secureQueryClause = builder.append(filter1, filter2).append(filter3).toQueryClause()\n ```\n \n Yes, did I mention that `append` also supports chaining? :wink:\n \n-### `toSearch()`\n+### `toQueryClause()`\n \n-`toSearch` is very straightforward. It unwraps the accumulated filter. It should be called subsequent to calls to\n-`append`. `append` will take the latest state of the search/filter into account while chaining. For example,\n+`toQueryClause` is very straightforward. It unwraps the accumulated filter. It should be called subsequent to calls to\n+`append`. `append` will take the latest state of the query clause into account while chaining. For example,\n you could go from a query, to a filtered query with a `should` filter, to a filtered query with a `must` filter.\n+Once you have a query clause, you can forward the final payload off to elasticsearch:\n+\n+```\n+var elasticsearch = require('elasticsearch')\n+var FilterBuilder = require('elasticsearch-filter-append')\n+\n+var queryClause = {\n+  filter: {\n+    term: {\n+      name: 'Atlanta, GA'\n+    }\n+  }\n+}\n+\n+var filter = {\n+  term: {\n+    name: 'Wimberly'\n+  }\n+}\n+\n+var builder = new FilterBuilder(queryClause)\n+\n+var secureQueryClause = builder.append(filter)\n+\n+elasticsearch.search({\n+  body: secureQueryClause,","path":"README.md","position":109,"original_position":109,"commit_id":"6e605f4bb3210402f1c461defd0116695c33d6af","original_commit_id":"6e605f4bb3210402f1c461defd0116695c33d6af","user":{"login":"tone81","id":233491,"avatar_url":"https://avatars.githubusercontent.com/u/233491?v=3","gravatar_id":"","url":"https://api.github.com/users/tone81","html_url":"https://github.com/tone81","followers_url":"https://api.github.com/users/tone81/followers","following_url":"https://api.github.com/users/tone81/following{/other_user}","gists_url":"https://api.github.com/users/tone81/gists{/gist_id}","starred_url":"https://api.github.com/users/tone81/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tone81/subscriptions","organizations_url":"https://api.github.com/users/tone81/orgs","repos_url":"https://api.github.com/users/tone81/repos","events_url":"https://api.github.com/users/tone81/events{/privacy}","received_events_url":"https://api.github.com/users/tone81/received_events","type":"User","site_admin":false},"body":"Should this be `searchQueryClause.toQueryClause()`?","created_at":"2015-11-04T20:14:37Z","updated_at":"2015-11-04T20:14:37Z","html_url":"https://github.com/lanetix/elasticsearch-filter-append/pull/2#discussion_r43933010","pull_request_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/comments/43933010"},"html":{"href":"https://github.com/lanetix/elasticsearch-filter-append/pull/2#discussion_r43933010"},"pull_request":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2","id":49735727,"html_url":"https://github.com/lanetix/elasticsearch-filter-append/pull/2","diff_url":"https://github.com/lanetix/elasticsearch-filter-append/pull/2.diff","patch_url":"https://github.com/lanetix/elasticsearch-filter-append/pull/2.patch","issue_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/2","number":2,"state":"open","locked":false,"title":"replace `toSearch` with `toQueryClause`","user":{"login":"armw4","id":246377,"avatar_url":"https://avatars.githubusercontent.com/u/246377?v=3","gravatar_id":"","url":"https://api.github.com/users/armw4","html_url":"https://github.com/armw4","followers_url":"https://api.github.com/users/armw4/followers","following_url":"https://api.github.com/users/armw4/following{/other_user}","gists_url":"https://api.github.com/users/armw4/gists{/gist_id}","starred_url":"https://api.github.com/users/armw4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armw4/subscriptions","organizations_url":"https://api.github.com/users/armw4/orgs","repos_url":"https://api.github.com/users/armw4/repos","events_url":"https://api.github.com/users/armw4/events{/privacy}","received_events_url":"https://api.github.com/users/armw4/received_events","type":"User","site_admin":false},"body":"the terminology was bad. it is not a search, but instead, a component of\r\na search. search related information like sorting and paging are not\r\nincluded as apart of our input. it's at a higher level. this library\r\nonly acts on the query dsl portion of the actual search itself. this is\r\nvery misleading and would be sure to confuse consumers.\r\n\r\nthis will be the birth of `v2.0.0` as this is obviously a breaking change.","created_at":"2015-11-04T19:46:52Z","updated_at":"2015-11-04T20:14:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d6eadd37728e49e58f9be8812b1d89959895f0b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2/commits","review_comments_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2/comments","review_comment_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/2/comments","statuses_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/statuses/6e605f4bb3210402f1c461defd0116695c33d6af","head":{"label":"lanetix:to-query-clause","ref":"to-query-clause","sha":"6e605f4bb3210402f1c461defd0116695c33d6af","user":{"login":"lanetix","id":5638751,"avatar_url":"https://avatars.githubusercontent.com/u/5638751?v=3","gravatar_id":"","url":"https://api.github.com/users/lanetix","html_url":"https://github.com/lanetix","followers_url":"https://api.github.com/users/lanetix/followers","following_url":"https://api.github.com/users/lanetix/following{/other_user}","gists_url":"https://api.github.com/users/lanetix/gists{/gist_id}","starred_url":"https://api.github.com/users/lanetix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanetix/subscriptions","organizations_url":"https://api.github.com/users/lanetix/orgs","repos_url":"https://api.github.com/users/lanetix/repos","events_url":"https://api.github.com/users/lanetix/events{/privacy}","received_events_url":"https://api.github.com/users/lanetix/received_events","type":"Organization","site_admin":false},"repo":{"id":45421645,"name":"elasticsearch-filter-append","full_name":"lanetix/elasticsearch-filter-append","owner":{"login":"lanetix","id":5638751,"avatar_url":"https://avatars.githubusercontent.com/u/5638751?v=3","gravatar_id":"","url":"https://api.github.com/users/lanetix","html_url":"https://github.com/lanetix","followers_url":"https://api.github.com/users/lanetix/followers","following_url":"https://api.github.com/users/lanetix/following{/other_user}","gists_url":"https://api.github.com/users/lanetix/gists{/gist_id}","starred_url":"https://api.github.com/users/lanetix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanetix/subscriptions","organizations_url":"https://api.github.com/users/lanetix/orgs","repos_url":"https://api.github.com/users/lanetix/repos","events_url":"https://api.github.com/users/lanetix/events{/privacy}","received_events_url":"https://api.github.com/users/lanetix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lanetix/elasticsearch-filter-append","description":null,"fork":false,"url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append","forks_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/forks","keys_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/teams","hooks_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/hooks","issue_events_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/events{/number}","events_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/events","assignees_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/assignees{/user}","branches_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/branches{/branch}","tags_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/tags","blobs_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/refs{/sha}","trees_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/statuses/{sha}","languages_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/languages","stargazers_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/stargazers","contributors_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/contributors","subscribers_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/subscribers","subscription_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/subscription","commits_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/commits{/sha}","git_commits_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/commits{/sha}","comments_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/comments{/number}","issue_comment_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/comments{/number}","contents_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/contents/{+path}","compare_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/merges","archive_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/downloads","issues_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues{/number}","pulls_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls{/number}","milestones_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/milestones{/number}","notifications_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/labels{/name}","releases_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/releases{/id}","created_at":"2015-11-02T20:58:08Z","updated_at":"2015-11-03T04:01:43Z","pushed_at":"2015-11-04T19:46:53Z","git_url":"git://github.com/lanetix/elasticsearch-filter-append.git","ssh_url":"git@github.com:lanetix/elasticsearch-filter-append.git","clone_url":"https://github.com/lanetix/elasticsearch-filter-append.git","svn_url":"https://github.com/lanetix/elasticsearch-filter-append","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"lanetix:master","ref":"master","sha":"cc1b17fdff53764a7e6e3343314b59f9f3de082b","user":{"login":"lanetix","id":5638751,"avatar_url":"https://avatars.githubusercontent.com/u/5638751?v=3","gravatar_id":"","url":"https://api.github.com/users/lanetix","html_url":"https://github.com/lanetix","followers_url":"https://api.github.com/users/lanetix/followers","following_url":"https://api.github.com/users/lanetix/following{/other_user}","gists_url":"https://api.github.com/users/lanetix/gists{/gist_id}","starred_url":"https://api.github.com/users/lanetix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanetix/subscriptions","organizations_url":"https://api.github.com/users/lanetix/orgs","repos_url":"https://api.github.com/users/lanetix/repos","events_url":"https://api.github.com/users/lanetix/events{/privacy}","received_events_url":"https://api.github.com/users/lanetix/received_events","type":"Organization","site_admin":false},"repo":{"id":45421645,"name":"elasticsearch-filter-append","full_name":"lanetix/elasticsearch-filter-append","owner":{"login":"lanetix","id":5638751,"avatar_url":"https://avatars.githubusercontent.com/u/5638751?v=3","gravatar_id":"","url":"https://api.github.com/users/lanetix","html_url":"https://github.com/lanetix","followers_url":"https://api.github.com/users/lanetix/followers","following_url":"https://api.github.com/users/lanetix/following{/other_user}","gists_url":"https://api.github.com/users/lanetix/gists{/gist_id}","starred_url":"https://api.github.com/users/lanetix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lanetix/subscriptions","organizations_url":"https://api.github.com/users/lanetix/orgs","repos_url":"https://api.github.com/users/lanetix/repos","events_url":"https://api.github.com/users/lanetix/events{/privacy}","received_events_url":"https://api.github.com/users/lanetix/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lanetix/elasticsearch-filter-append","description":null,"fork":false,"url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append","forks_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/forks","keys_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/teams","hooks_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/hooks","issue_events_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/events{/number}","events_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/events","assignees_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/assignees{/user}","branches_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/branches{/branch}","tags_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/tags","blobs_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/refs{/sha}","trees_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/statuses/{sha}","languages_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/languages","stargazers_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/stargazers","contributors_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/contributors","subscribers_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/subscribers","subscription_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/subscription","commits_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/commits{/sha}","git_commits_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/git/commits{/sha}","comments_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/comments{/number}","issue_comment_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/comments{/number}","contents_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/contents/{+path}","compare_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/merges","archive_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/downloads","issues_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues{/number}","pulls_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls{/number}","milestones_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/milestones{/number}","notifications_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/labels{/name}","releases_url":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/releases{/id}","created_at":"2015-11-02T20:58:08Z","updated_at":"2015-11-03T04:01:43Z","pushed_at":"2015-11-04T19:46:53Z","git_url":"git://github.com/lanetix/elasticsearch-filter-append.git","ssh_url":"git@github.com:lanetix/elasticsearch-filter-append.git","clone_url":"https://github.com/lanetix/elasticsearch-filter-append.git","svn_url":"https://github.com/lanetix/elasticsearch-filter-append","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2"},"html":{"href":"https://github.com/lanetix/elasticsearch-filter-append/pull/2"},"issue":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/2"},"comments":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/lanetix/elasticsearch-filter-append/statuses/6e605f4bb3210402f1c461defd0116695c33d6af"}}}}