Improve terms aggregation to perform the segment ordinal to global ordinal lookup post segment collection

In case when there are not too many unique values it is better to do the segment ordinal to global ordinal lookup after segment results have been processed.