Multi Type Search Using java API more specifically Spring Data Elasticsearch

I want to Search My Index in all Types and all fields for the query. I know how to do it using REST way. I want to know how to do it using JAVA API and more specifically in Spring Data Elasticsearch.

This is some code i have written but seams to be pretty messed in terms of return Type.

public Page searchInAll(String searchQuery) {

MatchQueryBuilder matchQueryBuilder =QueryBuilders.matchQuery("_all", "trump");
SearchQuery searchQueryFinal = new NativeSearchQueryBuilder().withQuery(matchQueryBuilder).withIndices("booksearchserver").withTypes("authors","books").build();

return elasticsearchTemplate.queryForPage(searchQueryFinal, Author.class, new SearchResultMapper(){

    public <T> FacetedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) {

        long totalHits = response.getHits().getTotalHits();
        List<Book> content = new ArrayList<Book>();
        for (SearchHit searchHit : response.getHits()) {
            if (response.getHits().getHits().length <= 0) {
                return null;
            }else if(searchHit.getType().equals("books")){
      "Creating Book,Mapping Book,Adding Book to Page");
            else if(searchHit.getType().equals("author")){
      "Creating Author,Mapping Author,Adding Author to Page");

        List<FacetResult> facets = new ArrayList<FacetResult>();
        if (response.getFacets() != null) {
            for (Facet facet : response.getFacets()) {
                FacetResult facetResult = DefaultFacetMapper.parse(facet);
                if (facetResult != null) {

        return new FacetedPageImpl<T>((List<T>)content, pageable, totalHits, facets);