Updated for Elasticsearch 1.0 aggregations