Original commit message

ChangeScribe message

Terms aggregations: make size=0 return all terms.


Terms aggregations return up to `size` terms, so up to now, the way to get all

matching terms back was to set `size` to an arbitrary high number that would be

larger than the number of unique terms.


Terms aggregators already made sure to not allocate memory based on the `size`

parameter so this commit mostly consists in making `0` an alias for the

maximum integer value in the TermsParser.


Close #4837


BUG - FEATURE: <type-ID>


This is a large modifier commit: this is a commit with many methods and combines multiple roles. This change set is mainly composed of:


1. Changes to package org.elasticsearch.search.aggregations.bucket.terms:


1.1. Modifications to InternalTerms.java:


1.1.1. Add a functionality to read size

1.1.2. Add a functionality to write size


The added/removed methods triggered changes to DoubleTerms class, LongTerms class, StringTerms class, UnmappedTerms class


1.2. Modifications to UnmappedTerms.java:


1.2.1. Modify assignment of this.requiredSize type at readFrom(StreamInput) method

1.2.2. Modify method invocation out at writeTo(StreamOutput) method