GROUP N BY via JSON

Good day.
According to the manual it is possible to get N rows for each group using GROUP N BY, like:
SELECT release_year, title FROM films GROUP 2 BY release_year ORDER BY release_year DESC LIMIT 6;

Is it possible to limit group size via JSON query (haven’t found something like this in the manual) using something like ‘group_size’ ?
‘size’ inside ‘terms’ limits the length of buckets (groups), but not the number of rows for each group in the resulting hits.

Unfortunately, you can’t do that with a JSON query.