{"action":"closed","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/20944","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20944/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20944/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20944/events","html_url":"https://github.com/elastic/elasticsearch/issues/20944","id":183114602,"number":20944,"title":"Query for negative number value returns matches on positive results","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},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/bug","name":"bug","color":"9e2c2c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-14T18:06:07Z","updated_at":"2016-10-14T18:47:32Z","closed_at":"2016-10-14T18:47:32Z","body":"Querying a number field for a negative number returns the same result as if it was a query for a positive number.\r\n\r\nRequest:\r\n```\r\nPOST logstash-0/_search\r\n{  \r\n   \"size\":1,\r\n \"query\" : {\r\n    \"bool\" : {\r\n      \"must\" : [\r\n        {\r\n          \"query_string\" : {\r\n            \"query\" : \"bytes=-199\",\r\n            \"fields\" : [ ],\r\n            \"use_dis_max\" : true,\r\n            \"tie_breaker\" : 0.0,\r\n            \"default_operator\" : \"or\",\r\n            \"auto_generate_phrase_queries\" : false,\r\n            \"max_determined_states\" : 10000,\r\n            \"lowercase_expanded_terms\" : true,\r\n            \"enable_position_increment\" : true,\r\n            \"fuzziness\" : \"AUTO\",\r\n            \"fuzzy_prefix_length\" : 0,\r\n            \"fuzzy_max_expansions\" : 50,\r\n            \"phrase_slop\" : 0,\r\n            \"analyze_wildcard\" : true,\r\n            \"locale\" : \"und\",\r\n            \"escape\" : false,\r\n            \"boost\" : 1.0\r\n          }\r\n        },\r\n        {\r\n          \"range\" : {\r\n            \"@timestamp\" : {\r\n              \"from\" : null,\r\n              \"to\" : null,\r\n              \"include_lower\" : true,\r\n              \"include_upper\" : true,\r\n              \"format\" : \"epoch_millis\",\r\n              \"boost\" : 1.0\r\n            }\r\n          }\r\n        }\r\n      ],\r\n      \"disable_coord\" : false,\r\n      \"adjust_pure_negative\" : true,\r\n      \"boost\" : 1.0\r\n    }\r\n  },\r\n\r\n   \"_source\":true,\r\n   \"script_fields\":{  \r\n    \"mypainless\" : {\r\n      \"script\" : {\r\n        \"inline\" : \"true\",\r\n        \"lang\" : \"painless\"\r\n      },\r\n      \"ignore_failure\" : false\r\n    }\r\n   },\r\n   \"docvalue_fields\":[  \r\n      \"utc_time\",\r\n      \"relatedContent.article:modified_time\",\r\n      \"@timestamp\",\r\n      \"relatedContent.article:published_time\"\r\n   ]\r\n}\r\n```\r\n\r\nResponse:\r\n```\r\n{\r\n  \"took\": 1,\r\n  \"timed_out\": false,\r\n  \"_shards\": {\r\n    \"total\": 1,\r\n    \"successful\": 1,\r\n    \"failed\": 0\r\n  },\r\n  \"hits\": {\r\n    \"total\": 4,\r\n    \"max_score\": 14.922283,\r\n    \"hits\": [\r\n      {\r\n        \"_index\": \"logstash-0\",\r\n        \"_type\": \"apache\",\r\n        \"_id\": \"AVe1dpRhJGOhgatAr2-c\",\r\n        \"_score\": 14.922283,\r\n        \"_source\": {\r\n          \"index\": \"logstash-0\",\r\n          \"@timestamp\": \"2016-10-10T19:09:05.192Z\",\r\n          \"ip\": \"99.61.124.180\",\r\n          \"extension\": \"gif\",\r\n          \"response\": \"200\",\r\n          \"geo\": {\r\n            \"coordinates\": {\r\n              \"lat\": 38.36562278,\r\n              \"lon\": -85.73829639\r\n            },\r\n            \"src\": \"NG\",\r\n            \"dest\": \"MX\",\r\n            \"srcdest\": \"NG:MX\"\r\n          },\r\n          \"@tags\": [\r\n            \"success\",\r\n            \"info\"\r\n          ],\r\n          \"utc_time\": \"2016-10-10T19:09:05.192Z\",\r\n          \"referer\": \"http://www.slate.com/success/krasimir-stoyanov\",\r\n          \"agent\": \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\",\r\n          \"clientip\": \"99.61.124.180\",\r\n          \"bytes\": 199,\r\n          \"host\": \"motion-media.theacademyofperformingartsandscience.org\",\r\n          \"request\": \"/canhaz/dmitri-kondratyev.gif\",\r\n          \"url\": \"https://motion-media.theacademyofperformingartsandscience.org/canhaz/dmitri-kondratyev.gif\",\r\n          \"@message\": \"99.61.124.180 - - [2016-10-10T19:09:05.192Z] \\\"GET /canhaz/dmitri-kondratyev.gif HTTP/1.1\\\" 200 199 \\\"-\\\" \\\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\\\"\",\r\n          \"spaces\": \"this   is   a   thing    with lots of     spaces       wwwwoooooo\",\r\n          \"xss\": \"<script>console.log(\\\"xss\\\")</script>\",\r\n          \"headings\": [\r\n            \"<h3>wendy-lawrence</h5>\",\r\n            \"http://twitter.com/warning/peggy-whitson\"\r\n          ],\r\n          \"links\": [\r\n            \"yevgeny-khrunov@www.slate.com\",\r\n            \"http://facebook.com/info/ulrich-walter\",\r\n            \"www.twitter.com\"\r\n          ],\r\n          \"relatedContent\": [],\r\n          \"machine\": {\r\n            \"os\": \"ios\",\r\n            \"ram\": 10737418240\r\n          }\r\n        },\r\n        \"fields\": {\r\n          \"mypainless\": [\r\n            true\r\n          ],\r\n          \"@timestamp\": [\r\n            1476126545192\r\n          ],\r\n          \"utc_time\": [\r\n            1476126545192\r\n          ]\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"Stacey-Gammon"}}