Add `shard_min_doc_count` parameter to terms aggregation

This was discussed in issue #6041 and #5998 . The parameter already exists for significant terms aggregation.

There are also two refactoring commits:
 
I tried to extract the parsing of common parameters for of significant terms and terms aggregation to get rid of some duplicate code.

Also, I refactored terms and significant terms aggregation a little: `requiredSize`, `shardSize`, `minDocCount` and `shardMinDocCount` are stored in a class called `BucketCountThresholds`. Before, every class using these parameters had their own member where these four are stored. This clutters the code. Because they are mostly needed together it might make sense to group them. I hope that this makes the code more readable.