@yrodiere now I just feel silly… sorry, I guess I am an old java fart when it comes to things. I was thinking I needed to do this in a the java 8 sorta way without the extension, even though I am using java 11.
So yes the var step worked perfectly. I had almost got to the point of:
SearchQueryOptionsStep<?, E, SearchLoadingOptionsStep, ?, ?> step = ...
I was missing the SearchLoadingOptionsStep class in the definition. The var step works great… it also allows me to make the sort conditional as well.
I had not got to the part about pulling the aggs out of the result, thank you for the example.