{"action":"created","issue":{"url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/601","repository_url":"https://api.github.com/repos/matteodem/meteor-easy-search","labels_url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/601/labels{/name}","comments_url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/601/comments","events_url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/601/events","html_url":"https://github.com/matteodem/meteor-easy-search/pull/601","id":223630593,"number":601,"title":"WIP: ES aggregations.","user":{"login":"bompi88","id":3270628,"avatar_url":"https://avatars1.githubusercontent.com/u/3270628?v=3","gravatar_id":"","url":"https://api.github.com/users/bompi88","html_url":"https://github.com/bompi88","followers_url":"https://api.github.com/users/bompi88/followers","following_url":"https://api.github.com/users/bompi88/following{/other_user}","gists_url":"https://api.github.com/users/bompi88/gists{/gist_id}","starred_url":"https://api.github.com/users/bompi88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bompi88/subscriptions","organizations_url":"https://api.github.com/users/bompi88/orgs","repos_url":"https://api.github.com/users/bompi88/repos","events_url":"https://api.github.com/users/bompi88/events{/privacy}","received_events_url":"https://api.github.com/users/bompi88/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-23T11:49:23Z","updated_at":"2017-04-23T18:18:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/matteodem/meteor-easy-search/pulls/601","html_url":"https://github.com/matteodem/meteor-easy-search/pull/601","diff_url":"https://github.com/matteodem/meteor-easy-search/pull/601.diff","patch_url":"https://github.com/matteodem/meteor-easy-search/pull/601.patch"},"body":"Implementing Elasticsearch aggregations, which are published together with the hits data.\r\n\r\nIn current implementation, the aggregations are injected in the `body` function like so:\r\n``` javascript\r\nvar index = new EasySearch.Index({\r\n  ...\r\n  engine: new EasySearch.ElasticSearch({\r\n    'body': function(body, opts) {\r\n      body.aggs = {\r\n        tags:{\r\n          filter: {},\r\n          aggs: {\r\n            tags: {\r\n              terms: { field: 'tags.not_analyzed' }\r\n            }\r\n          }\r\n        }\r\n      };\r\n      return body;\r\n    }\r\n    ...\r\n  }\r\n});\r\n```\r\n\r\nand gets accessible on the cursor returned by the `search` method like this:\r\n\r\n```javascript\r\nvar cursor = index.search('test');\r\n\r\n// get all aggregations\r\ncursor.getAggregations();\r\n\r\n// get aggregation by name\r\ncursor.getAggregation('tags');\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/comments/296471833","html_url":"https://github.com/matteodem/meteor-easy-search/pull/601#issuecomment-296471833","issue_url":"https://api.github.com/repos/matteodem/meteor-easy-search/issues/601","id":296471833,"user":{"login":"matteodem","id":1301147,"avatar_url":"https://avatars3.githubusercontent.com/u/1301147?v=3","gravatar_id":"","url":"https://api.github.com/users/matteodem","html_url":"https://github.com/matteodem","followers_url":"https://api.github.com/users/matteodem/followers","following_url":"https://api.github.com/users/matteodem/following{/other_user}","gists_url":"https://api.github.com/users/matteodem/gists{/gist_id}","starred_url":"https://api.github.com/users/matteodem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matteodem/subscriptions","organizations_url":"https://api.github.com/users/matteodem/orgs","repos_url":"https://api.github.com/users/matteodem/repos","events_url":"https://api.github.com/users/matteodem/events{/privacy}","received_events_url":"https://api.github.com/users/matteodem/received_events","type":"User","site_admin":false},"created_at":"2017-04-23T18:18:56Z","updated_at":"2017-04-23T18:18:56Z","body":"wow, good stuff! looking forward"}}
{"actor":{"display_login":"matteodem"}}