I am currently doing migration from spring data elastic search 3.2.X to 4.0.0.
I had been relying on obtaining inner hits result through raw SearchResponse class by utilizing the now deprecated low level function org.springframework.data.elasticsearch.core.ElasticsearchOperations.query(SearchQuery query, ResultsExtractor resultsExtractor);
Basically what I did was creating custom resultExtractor which will expose the low level SearchResponse so that I could then extract the inner hits result.
Now with version 4.0.0 that functionality is no longer there, Both ElasticSearchOperations and ElasticSearchRestTemplate utilize new result class called SearchHits which AFAIK does not store inner hits information.
The workaround I could think of besides using the restHighLevelClient directly (which of course is undesirable since I'd lose the object mapping and stuff) is to extend ElasticSearchRestTemplate and basically creating new implementation of search(Query query, Class clazz, IndexCoordinates index) which will return SearchHits and the raw search response (similar to what my custom ResultExtractor used to do).
Afterwards, since all api returning page instance has been deprecated, I would now have to rely on SearchHitSupport.searchPageFor(SearchHits searchHits, @Nullable Pageable pageable) to get the usual paging functionalities.
I felt that this is not very straightforward and clean solution and certainly felt more like a workaround. Would there be any more straightforward way to obtain innerHitsResult and map result content to page at version 4.0.0?