Search: Reduce memory usage during fetch source sub phase.

If includes or excludes are set
XContentFactory.xcontentBuilder() allocates a new
BytesStreamOutput using the default page size which is 16kb.

Can be optimized to use the length of the sourceRef because
that is the maximum possible size that the streamOutput will
use.

This redcues the amount of memory allocated for a request
that is fetching 200.000 small documents (~150 bytes each)
by about 300 MB

Close #8138
Tests: Move logSegmentsState to shared location, and remove no longer
needed verbose logging from upgrade test.
Core: Allow to configure custom thread pools

Closes #8247