ruflin/Elastica — pull request #552 by krzaczek (2014-02-14 12:46:37+00:00)
Title: Aggregations

TermAggregation - added methods setSize and setShradSize
@see http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/search-aggregations-bucket-terms-aggregation.html#_size_amp_shard_size

GlobalAggregation - there was a bug here - now a JSON with a global aggregation looka like this

"aggs": {
"global": {
"global": [
]
}
}

The global key should be "global": {} not "global": [] - this is because empty array is returned in JSON as [] but this cause ES to not return global aggregation at all in the result set.

Added if statement to check if array is empty and if it's empty set it to empty Object - this way the JSON send to ES is correct

"aggs": {
"global": {
"global": {
}
}
}