{"action":"closed","issue":{"url":"https://api.github.com/repos/olivere/elastic/issues/423","repository_url":"https://api.github.com/repos/olivere/elastic","labels_url":"https://api.github.com/repos/olivere/elastic/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/olivere/elastic/issues/423/comments","events_url":"https://api.github.com/repos/olivere/elastic/issues/423/events","html_url":"https://github.com/olivere/elastic/issues/423","id":195780233,"number":423,"title":"Combine a filtered query with an average aggregate","user":{"login":"andrejvanderzee","id":1555310,"avatar_url":"https://avatars.githubusercontent.com/u/1555310?v=3","gravatar_id":"","url":"https://api.github.com/users/andrejvanderzee","html_url":"https://github.com/andrejvanderzee","followers_url":"https://api.github.com/users/andrejvanderzee/followers","following_url":"https://api.github.com/users/andrejvanderzee/following{/other_user}","gists_url":"https://api.github.com/users/andrejvanderzee/gists{/gist_id}","starred_url":"https://api.github.com/users/andrejvanderzee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrejvanderzee/subscriptions","organizations_url":"https://api.github.com/users/andrejvanderzee/orgs","repos_url":"https://api.github.com/users/andrejvanderzee/repos","events_url":"https://api.github.com/users/andrejvanderzee/events{/privacy}","received_events_url":"https://api.github.com/users/andrejvanderzee/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-15T11:20:23Z","updated_at":"2016-12-17T12:52:29Z","closed_at":"2016-12-17T12:52:29Z","body":"### Which version of Elastic are you using?\r\n\r\n[ X] elastic.v2 (for Elasticsearch 1.x)\r\n\r\nHow can we combine a filtered query with an average aggregate like this:\r\n\r\n```\r\n{\r\n\t\"query\": {\r\n\t\t\"filtered\": {\r\n\t\t\t\"query\": {\r\n\t\t\t\t\"query_string\": {\r\n\t\t\t\t\t\"query\": \"env:dev AND metricType:total\",\r\n\t\t\t\t\t\"analyze_wildcard\": true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"filter\": {\r\n\t\t\t\t\"bool\": {\r\n\t\t\t\t\t\"must\": [{\r\n\t\t\t\t\t\t\"range\": {\r\n\t\t\t\t\t\t\t\"timestamp\": {\r\n\t\t\t\t\t\t\t\t\"gte\": 1481748200544,\r\n\t\t\t\t\t\t\t\t\"lte\": 1481750000544,\r\n\t\t\t\t\t\t\t\t\"format\": \"epoch_millis\"\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}],\r\n\t\t\t\t\t\"must_not\": []\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n\t\"size\": 0,\r\n\t\"aggs\": {\r\n\t\t\"1\": {\r\n\t\t\t\"avg\": {\r\n\t\t\t\t\"field\": \"available\"\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n```"}}
{"actor":{"display_login":"olivere"}}