According to Elastic docs, size: 0 on terms aggregation will be deprecated. Please see https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_aggregations_changes.html#_literal_size_0_literal_on_terms_significant_terms_and_geohash_grid_aggregations
In the prior versions of Elasticsearch, size of 0 results in size being set to Integer.MAX_VALUE. It seems to return all the buckets. How can I achieve the functionality of size: 0 in Elasticsearch 5.x?