{"action":"created","comment":{"url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/comments/28660645","id":28660645,"diff_hunk":"@@ -532,7 +558,180 @@\n \n       context \"and > operand\" do\n         let(:query_string) do\n-          \"created_at:>2012-02-29\"\n+          \"stocks:>100\"\n+        end\n+\n+        it \"returns range filter\" do\n+          is_expected.to eq(\n+            \"filtered\" => {\n+              \"filter\" => {\n+                \"range\" => {\n+                  \"stocks\" => {\n+                    \"gt\" => 100,\n+                  },\n+                },\n+              },\n+            },\n+          )\n+        end\n+      end\n+\n+      context \"and multiple operands\" do\n+        let(:query_string) do\n+          \"stocks:>=100 stocks:<=200\"\n+        end\n+\n+        it \"returns two range filters within bool filter\" do\n+          is_expected.to eq(\n+            \"filtered\" => {\n+              \"filter\" => {\n+                \"bool\" => {\n+                  \"_cache\" => true,\n+                  \"must\" => [\n+                    {\n+                      \"range\" => {\n+                        \"stocks\" => {\n+                          \"gte\" => 100,\n+                        },\n+                      },\n+                    },\n+                    {\n+                      \"range\" => {\n+                        \"stocks\" => {\n+                          \"lte\" => 200,\n+                        },\n+                      },\n+                    },\n+                  ],\n+                },\n+              },\n+            },\n+          )\n+        end\n+      end\n+    end\n+\n+    context \"with date field name\" do\n+      let(:filterable_fields) do\n+        [\"created_at\"]\n+      end\n+\n+      let(:date_fields) do\n+        [\"created_at\"]\n+      end\n+\n+      context \"and query is invalid as date representation\" do\n+        let(:query_string) do\n+          \"created_at:aaa\"\n+        end\n+\n+        it \"returns treats the query as 0\" do\n+          is_expected.to eq(\n+            \"filtered\" => {\n+              \"filter\" => {\n+                \"term\" => {\n+                  \"created_at\" => \"aaa\",","path":"spec/qiita/elasticsearch/query_builder_spec.rb","position":165,"original_position":165,"commit_id":"1e4b07ce322c77b0d630cee15b234578455a8890","original_commit_id":"1e4b07ce322c77b0d630cee15b234578455a8890","user":{"login":"r7kamura","id":111689,"avatar_url":"https://avatars.githubusercontent.com/u/111689?v=3","gravatar_id":"","url":"https://api.github.com/users/r7kamura","html_url":"https://github.com/r7kamura","followers_url":"https://api.github.com/users/r7kamura/followers","following_url":"https://api.github.com/users/r7kamura/following{/other_user}","gists_url":"https://api.github.com/users/r7kamura/gists{/gist_id}","starred_url":"https://api.github.com/users/r7kamura/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r7kamura/subscriptions","organizations_url":"https://api.github.com/users/r7kamura/orgs","repos_url":"https://api.github.com/users/r7kamura/repos","events_url":"https://api.github.com/users/r7kamura/events{/privacy}","received_events_url":"https://api.github.com/users/r7kamura/received_events","type":"User","site_admin":false},"body":"it \"treats the query as 0\" のexampleでは `\"stocks\" => 0` だったけど it \"returns treats the query as 0\" のexampleでは `\"created_at\" => \"aaa\"` になるのはなぜ?","created_at":"2015-04-20T02:12:02Z","updated_at":"2015-04-20T02:12:02Z","html_url":"https://github.com/increments/qiita-elasticsearch/pull/2#discussion_r28660645","pull_request_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/comments/28660645"},"html":{"href":"https://github.com/increments/qiita-elasticsearch/pull/2#discussion_r28660645"},"pull_request":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2","id":33436988,"html_url":"https://github.com/increments/qiita-elasticsearch/pull/2","diff_url":"https://github.com/increments/qiita-elasticsearch/pull/2.diff","patch_url":"https://github.com/increments/qiita-elasticsearch/pull/2.patch","issue_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/2","number":2,"state":"open","locked":false,"title":"Support date_fields and time_zone parameters","user":{"login":"yuku-t","id":96157,"avatar_url":"https://avatars.githubusercontent.com/u/96157?v=3","gravatar_id":"","url":"https://api.github.com/users/yuku-t","html_url":"https://github.com/yuku-t","followers_url":"https://api.github.com/users/yuku-t/followers","following_url":"https://api.github.com/users/yuku-t/following{/other_user}","gists_url":"https://api.github.com/users/yuku-t/gists{/gist_id}","starred_url":"https://api.github.com/users/yuku-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuku-t/subscriptions","organizations_url":"https://api.github.com/users/yuku-t/orgs","repos_url":"https://api.github.com/users/yuku-t/repos","events_url":"https://api.github.com/users/yuku-t/events{/privacy}","received_events_url":"https://api.github.com/users/yuku-t/received_events","type":"User","site_admin":false},"body":"Add date_fields and time_zone parameters.\r\n\r\nAn exact query with a field in date_fields is automatically converted to a range query. Example:\r\n\r\ngiven | converted\r\n----|----\r\ncreated_at:2014 | created_at:>=2014-01-01 created_at:<2015-01-01\r\ncreated_at:2014-01 | created_at:>=2014-01-01 created_at:<2014-02-01\r\ncreated_at:2014-01-01 | craeted_at:>=2014-01-01 created_at:<2014-01-02\r\n\r\nSee http://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-range-filter.html#query-dsl-range-filter for how time_zone parameter works. Note that the time_zone parameter is added to elasticsearch in 1.4.0.Beta1.","created_at":"2015-04-16T10:22:02Z","updated_at":"2015-04-20T02:12:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9da70ea5c83227ef920a599d00713528f63245d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2/commits","review_comments_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2/comments","review_comment_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/2/comments","statuses_url":"https://api.github.com/repos/increments/qiita-elasticsearch/statuses/1e4b07ce322c77b0d630cee15b234578455a8890","head":{"label":"increments:timezone","ref":"timezone","sha":"1e4b07ce322c77b0d630cee15b234578455a8890","user":{"login":"increments","id":1674978,"avatar_url":"https://avatars.githubusercontent.com/u/1674978?v=3","gravatar_id":"","url":"https://api.github.com/users/increments","html_url":"https://github.com/increments","followers_url":"https://api.github.com/users/increments/followers","following_url":"https://api.github.com/users/increments/following{/other_user}","gists_url":"https://api.github.com/users/increments/gists{/gist_id}","starred_url":"https://api.github.com/users/increments/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/increments/subscriptions","organizations_url":"https://api.github.com/users/increments/orgs","repos_url":"https://api.github.com/users/increments/repos","events_url":"https://api.github.com/users/increments/events{/privacy}","received_events_url":"https://api.github.com/users/increments/received_events","type":"Organization","site_admin":false},"repo":{"id":32148432,"name":"qiita-elasticsearch","full_name":"increments/qiita-elasticsearch","owner":{"login":"increments","id":1674978,"avatar_url":"https://avatars.githubusercontent.com/u/1674978?v=3","gravatar_id":"","url":"https://api.github.com/users/increments","html_url":"https://github.com/increments","followers_url":"https://api.github.com/users/increments/followers","following_url":"https://api.github.com/users/increments/following{/other_user}","gists_url":"https://api.github.com/users/increments/gists{/gist_id}","starred_url":"https://api.github.com/users/increments/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/increments/subscriptions","organizations_url":"https://api.github.com/users/increments/orgs","repos_url":"https://api.github.com/users/increments/repos","events_url":"https://api.github.com/users/increments/events{/privacy}","received_events_url":"https://api.github.com/users/increments/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/increments/qiita-elasticsearch","description":"Elasticsearch client helper for Qiita.","fork":false,"url":"https://api.github.com/repos/increments/qiita-elasticsearch","forks_url":"https://api.github.com/repos/increments/qiita-elasticsearch/forks","keys_url":"https://api.github.com/repos/increments/qiita-elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/increments/qiita-elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/increments/qiita-elasticsearch/teams","hooks_url":"https://api.github.com/repos/increments/qiita-elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/increments/qiita-elasticsearch/events","assignees_url":"https://api.github.com/repos/increments/qiita-elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/increments/qiita-elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/increments/qiita-elasticsearch/tags","blobs_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/increments/qiita-elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/increments/qiita-elasticsearch/languages","stargazers_url":"https://api.github.com/repos/increments/qiita-elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/increments/qiita-elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/increments/qiita-elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/increments/qiita-elasticsearch/subscription","commits_url":"https://api.github.com/repos/increments/qiita-elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/increments/qiita-elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/increments/qiita-elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/increments/qiita-elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/increments/qiita-elasticsearch/merges","archive_url":"https://api.github.com/repos/increments/qiita-elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/increments/qiita-elasticsearch/downloads","issues_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/increments/qiita-elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/increments/qiita-elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/increments/qiita-elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/increments/qiita-elasticsearch/releases{/id}","created_at":"2015-03-13T09:54:37Z","updated_at":"2015-04-17T02:24:48Z","pushed_at":"2015-04-17T14:25:58Z","git_url":"git://github.com/increments/qiita-elasticsearch.git","ssh_url":"git@github.com:increments/qiita-elasticsearch.git","clone_url":"https://github.com/increments/qiita-elasticsearch.git","svn_url":"https://github.com/increments/qiita-elasticsearch","homepage":"","size":216,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"increments:master","ref":"master","sha":"4f9e672332ae142e1ca7a921761a75d04774be45","user":{"login":"increments","id":1674978,"avatar_url":"https://avatars.githubusercontent.com/u/1674978?v=3","gravatar_id":"","url":"https://api.github.com/users/increments","html_url":"https://github.com/increments","followers_url":"https://api.github.com/users/increments/followers","following_url":"https://api.github.com/users/increments/following{/other_user}","gists_url":"https://api.github.com/users/increments/gists{/gist_id}","starred_url":"https://api.github.com/users/increments/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/increments/subscriptions","organizations_url":"https://api.github.com/users/increments/orgs","repos_url":"https://api.github.com/users/increments/repos","events_url":"https://api.github.com/users/increments/events{/privacy}","received_events_url":"https://api.github.com/users/increments/received_events","type":"Organization","site_admin":false},"repo":{"id":32148432,"name":"qiita-elasticsearch","full_name":"increments/qiita-elasticsearch","owner":{"login":"increments","id":1674978,"avatar_url":"https://avatars.githubusercontent.com/u/1674978?v=3","gravatar_id":"","url":"https://api.github.com/users/increments","html_url":"https://github.com/increments","followers_url":"https://api.github.com/users/increments/followers","following_url":"https://api.github.com/users/increments/following{/other_user}","gists_url":"https://api.github.com/users/increments/gists{/gist_id}","starred_url":"https://api.github.com/users/increments/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/increments/subscriptions","organizations_url":"https://api.github.com/users/increments/orgs","repos_url":"https://api.github.com/users/increments/repos","events_url":"https://api.github.com/users/increments/events{/privacy}","received_events_url":"https://api.github.com/users/increments/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/increments/qiita-elasticsearch","description":"Elasticsearch client helper for Qiita.","fork":false,"url":"https://api.github.com/repos/increments/qiita-elasticsearch","forks_url":"https://api.github.com/repos/increments/qiita-elasticsearch/forks","keys_url":"https://api.github.com/repos/increments/qiita-elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/increments/qiita-elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/increments/qiita-elasticsearch/teams","hooks_url":"https://api.github.com/repos/increments/qiita-elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/increments/qiita-elasticsearch/events","assignees_url":"https://api.github.com/repos/increments/qiita-elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/increments/qiita-elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/increments/qiita-elasticsearch/tags","blobs_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/increments/qiita-elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/increments/qiita-elasticsearch/languages","stargazers_url":"https://api.github.com/repos/increments/qiita-elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/increments/qiita-elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/increments/qiita-elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/increments/qiita-elasticsearch/subscription","commits_url":"https://api.github.com/repos/increments/qiita-elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/increments/qiita-elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/increments/qiita-elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/increments/qiita-elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/increments/qiita-elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/increments/qiita-elasticsearch/merges","archive_url":"https://api.github.com/repos/increments/qiita-elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/increments/qiita-elasticsearch/downloads","issues_url":"https://api.github.com/repos/increments/qiita-elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/increments/qiita-elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/increments/qiita-elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/increments/qiita-elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/increments/qiita-elasticsearch/releases{/id}","created_at":"2015-03-13T09:54:37Z","updated_at":"2015-04-17T02:24:48Z","pushed_at":"2015-04-17T14:25:58Z","git_url":"git://github.com/increments/qiita-elasticsearch.git","ssh_url":"git@github.com:increments/qiita-elasticsearch.git","clone_url":"https://github.com/increments/qiita-elasticsearch.git","svn_url":"https://github.com/increments/qiita-elasticsearch","homepage":"","size":216,"stargazers_count":7,"watchers_count":7,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2"},"html":{"href":"https://github.com/increments/qiita-elasticsearch/pull/2"},"issue":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/2"},"comments":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/increments/qiita-elasticsearch/statuses/1e4b07ce322c77b0d630cee15b234578455a8890"}}}}