{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/20941","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20941/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20941/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20941/events","html_url":"https://github.com/elastic/elasticsearch/issues/20941","id":183057133,"number":20941,"title":"Boolean scripted field agg's are coming back as strings","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":[{"id":141141324,"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Aggregations","name":":Aggregations","color":"009800","default":false},{"id":92913858,"url":"https://api.github.com/repos/elastic/elasticsearch/labels/low%20hanging%20fruit","name":"low hanging fruit","color":"009800","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-14T13:58:50Z","updated_at":"2016-12-15T16:26:24Z","closed_at":"2016-12-14T09:04:53Z","body":"This is showing up as a 5.0 blocker for kibana in https://github.com/elastic/kibana/issues/8677\n\nI am requesting a scripted, painless field aggregation with value_type boolean, but it is being returned as a string.  value_type double works as expected.\n\nRequest:\n\n```\nPOST logstash-0/_search\n{  \n   \"size\":1,\n   \"query\":{\n   },\n   \"aggs\":{  \n      \"2\":{  \n        \"terms\": {\n          \"script\": {\n            \"inline\" : \"true\",\n            \"lang\": \"painless\"\n          },\n          \"value_type\": \"boolean\"\n        }\n      }\n   },\n   \"stored_fields\":[  \n      \"*\"\n   ],\n   \"_source\":true,\n   \"script_fields\":{  \n      \"inverse bytes\":{  \n         \"script\":{  \n            \"inline\":\"true\",\n            \"lang\":\"painless\"\n         }\n      }\n   },\n   \"docvalue_fields\":[  \n      \"utc_time\",\n      \"relatedContent.article:modified_time\",\n      \"@timestamp\",\n      \"relatedContent.article:published_time\"\n   ]\n}\n```\n\nResponse:\n\n```\n{\n  \"took\": 3,\n  \"timed_out\": false,\n  \"_shards\": {\n    \"total\": 1,\n    \"successful\": 1,\n    \"failed\": 0\n  },\n  \"hits\": {\n    \"total\": 14005,\n    \"max_score\": 1,\n    \"hits\": [\n      {\n        \"_index\": \"logstash-0\",\n        \"_type\": \"apache\",\n        \"_id\": \"AVe1doKCJGOhgatAr1_j\",\n        \"_score\": 1,\n        \"_source\": {\n          \"index\": \"logstash-0\",\n          \"@timestamp\": \"2016-10-10T17:32:10.221Z\",\n          \"ip\": \"42.251.131.74\",\n          \"extension\": \"jpg\",\n          \"response\": \"200\",\n          \"geo\": {\n            \"coordinates\": {\n              \"lat\": 36.74125,\n              \"lon\": -108.2299444\n            },\n            \"src\": \"IN\",\n            \"dest\": \"ID\",\n            \"srcdest\": \"IN:ID\"\n          },\n          \"@tags\": [\n            \"success\",\n            \"security\"\n          ],\n          \"utc_time\": \"2016-10-10T17:32:10.221Z\",\n          \"referer\": \"http://twitter.com/success/umberto-guidoni\",\n          \"agent\": \"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\",\n          \"clientip\": \"42.251.131.74\",\n          \"bytes\": 1973,\n          \"host\": \"media-for-the-masses.theacademyofperformingartsandscience.org\",\n          \"request\": \"/uploads/donald-deke-slayton.jpg\",\n          \"url\": \"https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/donald-deke-slayton.jpg\",\n          \"@message\": \"42.251.131.74 - - [2016-10-10T17:32:10.221Z] \\\"GET /uploads/donald-deke-slayton.jpg HTTP/1.1\\\" 200 1973 \\\"-\\\" \\\"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\\\"\",\n          \"spaces\": \"this   is   a   thing    with lots of     spaces       wwwwoooooo\",\n          \"xss\": \"<script>console.log(\\\"xss\\\")</script>\",\n          \"headings\": [\n            \"<h3>leonid-popov</h5>\",\n            \"http://www.slate.com/success/james-dutton\"\n          ],\n          \"links\": [\n            \"brian-duffy@twitter.com\",\n            \"http://www.slate.com/security/shannon-walker\",\n            \"www.twitter.com\"\n          ],\n          \"relatedContent\": [\n            {\n              \"url\": \"http://www.laweekly.com/news/nomadaz-street-art-from-spain-and-italy-at-scion-2368037\",\n              \"og:type\": \"article\",\n              \"og:title\": \"Nomadaz: Street Art from Spain and Italy at Scion\",\n              \"og:description\": \"Pablo Aravena curated the new show at Scion Space in Culver City. Nomadaz brings together eight street artists from Italy and Spain, including Microbo, ...\",\n              \"og:url\": \"http://www.laweekly.com/news/nomadaz-street-art-from-spain-and-italy-at-scion-2368037\",\n              \"article:published_time\": \"2008-03-11T13:09:36-07:00\",\n              \"article:modified_time\": \"2014-10-28T14:59:53-07:00\",\n              \"article:section\": \"News\",\n              \"og:image\": \"http://IMAGES1.laweekly.com/imager/nomadaz-street-art-from-spain-and-italy-a/u/original/2430333/img_5631.jpg\",\n              \"og:image:height\": \"640\",\n              \"og:image:width\": \"480\",\n              \"og:site_name\": \"LA Weekly\",\n              \"twitter:title\": \"Nomadaz: Street Art from Spain and Italy at Scion\",\n              \"twitter:description\": \"Pablo Aravena curated the new show at Scion Space in Culver City. Nomadaz brings together eight street artists from Italy and Spain, including Microbo, ...\",\n              \"twitter:card\": \"summary\",\n              \"twitter:image\": \"http://IMAGES1.laweekly.com/imager/nomadaz-street-art-from-spain-and-italy-a/u/original/2430333/img_5631.jpg\",\n              \"twitter:site\": \"@laweekly\"\n            },\n            {\n              \"url\": \"http://www.laweekly.com/music/the-police-at-the-hollywood-bowl-5-27-once-more-gentlemen-please-but-this-time-with-bad-feeling-2412476\",\n              \"og:type\": \"article\",\n              \"og:title\": \"The Police at the Hollywood Bowl 5/27: Once More Gentlemen Please, But This Time With Bad Feeling\",\n              \"og:description\": \"The Police at Hollywood Bowl, May 27, 2008 By Paul Rogers Sting&rsquo;s ego alone could fill the Hollywood Bowl, but on Tuesday night his band&rsquo;s p...\",\n              \"og:url\": \"http://www.laweekly.com/music/the-police-at-the-hollywood-bowl-5-27-once-more-gentlemen-please-but-this-time-with-bad-feeling-2412476\",\n              \"article:published_time\": \"2008-05-28T08:26:44-07:00\",\n              \"article:modified_time\": \"2014-11-27T07:38:12-08:00\",\n              \"article:section\": \"Music\",\n              \"article:tag\": \"Concerts and Tours\",\n              \"og:site_name\": \"LA Weekly\",\n              \"twitter:title\": \"The Police at the Hollywood Bowl 5/27: Once More Gentlemen Please, But This Time With Bad Feeling\",\n              \"twitter:description\": \"The Police at Hollywood Bowl, May 27, 2008 By Paul Rogers Sting&rsquo;s ego alone could fill the Hollywood Bowl, but on Tuesday night his band&rsquo;s p...\",\n              \"twitter:card\": \"summary\",\n              \"twitter:site\": \"@laweekly\"\n            },\n            {\n              \"url\": \"http://www.laweekly.com/arts/linda-immediato-2371473\",\n              \"og:type\": \"article\",\n              \"og:title\": \"Linda Immediato\",\n              \"og:description\": \"Linda Immediato recently lost her blogging virginity and is making up for lost time. She&#039;s a born and bred New Yorker who was an on-air news reporter fo...\",\n              \"og:url\": \"http://www.laweekly.com/arts/linda-immediato-2371473\",\n              \"article:published_time\": \"2005-10-14T12:10:19-07:00\",\n              \"article:modified_time\": \"2014-11-25T17:14:16-08:00\",\n              \"article:section\": \"Arts\",\n              \"og:image\": \"http://images1.laweekly.com/imager/linda-immediato/u/original/2435953/dscn0901_1_2.jpg\",\n              \"og:image:height\": \"211\",\n              \"og:image:width\": \"200\",\n              \"og:site_name\": \"LA Weekly\",\n              \"twitter:title\": \"Linda Immediato\",\n              \"twitter:description\": \"Linda Immediato recently lost her blogging virginity and is making up for lost time. She&#039;s a born and bred New Yorker who was an on-air news reporter fo...\",\n              \"twitter:card\": \"summary\",\n              \"twitter:image\": \"http://images1.laweekly.com/imager/linda-immediato/u/original/2435953/dscn0901_1_2.jpg\",\n              \"twitter:site\": \"@laweekly\"\n            },\n            {\n              \"url\": \"http://www.laweekly.com/arts/no-no-no-2372392\",\n              \"og:type\": \"article\",\n              \"og:title\": \"No No No...\",\n              \"og:description\": \"Maybe it was payback from the hater gods for being too happy and too much in love on Valentines Day, but the romantic dinner I&nbsp; bragged about havin...\",\n              \"og:url\": \"http://www.laweekly.com/arts/no-no-no-2372392\",\n              \"article:published_time\": \"2006-02-18T19:02:20-08:00\",\n              \"article:modified_time\": \"2014-11-25T20:09:29-08:00\",\n              \"article:section\": \"Arts\",\n              \"article:tag\": \"Eating Out\",\n              \"og:image\": \"http://images1.laweekly.com/imager/no-no-no/u/original/2438935/v245146.jpg\",\n              \"og:image:height\": \"404\",\n              \"og:image:width\": \"300\",\n              \"og:site_name\": \"LA Weekly\",\n              \"twitter:title\": \"No No No...\",\n              \"twitter:description\": \"Maybe it was payback from the hater gods for being too happy and too much in love on Valentines Day, but the romantic dinner I&nbsp; bragged about havin...\",\n              \"twitter:card\": \"summary\",\n              \"twitter:image\": \"http://images1.laweekly.com/imager/no-no-no/u/original/2438935/v245146.jpg\",\n              \"twitter:site\": \"@laweekly\"\n            }\n          ],\n          \"machine\": {\n            \"ram\": 12884901888\n          }\n        },\n        \"fields\": {\n          \"relatedContent.article:modified_time\": [\n            1414533593000,\n            1416964456000,\n            1416974969000,\n            1417102692000\n          ],\n          \"@timestamp\": [\n            1476120730221\n          ],\n          \"utc_time\": [\n            1476120730221\n          ],\n          \"relatedContent.article:published_time\": [\n            1129317019000,\n            1140318140000,\n            1205266176000,\n            1211988404000\n          ],\n          \"inverse bytes\": [\n            true\n          ]\n        }\n      }\n    ]\n  },\n  \"aggregations\": {\n    \"2\": {\n      \"doc_count_error_upper_bound\": 0,\n      \"sum_other_doc_count\": 0,\n      \"buckets\": [\n        {\n          \"key\": \"true\",\n          \"doc_count\": 14005\n        }\n      ]\n    }\n  }\n}\n```\n\nfwiw, I am capturing the request in slow log and when I pass `\"value_type\": \"boolean\"`, that line is getting stripped out. When I pass `\"value_type: \"double\"` it's being preserved in the logged request.  I admit I am not sure if ES is stripping value_type or Kibana is.\n"},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/267372162","html_url":"https://github.com/elastic/elasticsearch/issues/20941#issuecomment-267372162","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/20941","id":267372162,"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},"created_at":"2016-12-15T16:26:24Z","updated_at":"2016-12-15T16:26:24Z","body":"@jpountz I saw this was closed so I did some testing to see if we could remove our workaround in Kibana and I found that the terms agg no longer accepts boolean scripts. If I use a simplified version of the query Stacey provided above, I get an error:\r\n\r\nRequest:\r\n```\r\n{  \r\n   \"aggs\":{  \r\n      \"1\":{  \r\n        \"terms\": {\r\n          \"script\": {\r\n            \"inline\" : \"return true;\",\r\n            \"lang\": \"painless\"\r\n          },\r\n          \"value_type\": \"boolean\"\r\n        }\r\n      }\r\n   }\r\n}\r\n```\r\n\r\nResponse\r\n```\r\n{\r\n  \"took\": 3,\r\n  \"timed_out\": false,\r\n  \"_shards\": {\r\n    \"total\": 5,\r\n    \"successful\": 4,\r\n    \"failed\": 1,\r\n    \"failures\": [\r\n      {\r\n        \"shard\": 4,\r\n        \"index\": \"foo\",\r\n        \"node\": \"bAWZQ2m9SGutXsY_I_WLfg\",\r\n        \"reason\": {\r\n          \"type\": \"aggregation_execution_exception\",\r\n          \"reason\": \"Unsupported script value [true]\"\r\n        }\r\n      }\r\n    ]\r\n  },\r\n  \"hits\": {\r\n    \"total\": 0,\r\n    \"max_score\": null,\r\n    \"hits\": []\r\n  },\r\n  \"aggregations\": {\r\n    \"1\": {\r\n      \"doc_count_error_upper_bound\": 0,\r\n      \"sum_other_doc_count\": 0,\r\n      \"buckets\": []\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nIs this an unintentional side effect of the PR that closed this?"}}
{"actor":{"display_login":"Bargs"}}