I am currently stuck with a result response from a multi-search that 
returns an array of responses for each query I add, but I need the 
responses to be combined so that the relevancy to determine their order. 
Getting back two separated lists of hits isn't great for creating a unified 
search results page.

My current code for searching is:

SearchRequestBuilder srb1 = client.prepareSearch(category)                      
    .setSearchType(SearchType.QUERY_THEN_FETCH)
    
.setQuery(QueryBuilders.queryString(query).field("body").field("title").field("author")
    
.addHighlightedField("body").addHighlightedField("title").addHighlightedField("author")
    .setHighlighterPreTags("<div 
class='highlight'>").setHighlighterPostTags("</div>");
SearchRequestBuilder srb2 = client.prepareSearch(category+"_pdfs")              
    
    .setSearchType(SearchType.QUERY_THEN_FETCH)
    .setQuery(
        QueryBuilders.queryString(query)
        .field("file")
        .field("title")
        .field("author")
    )
    
.addHighlightedField("file").addHighlightedField("title").addHighlightedField("author")
    .setHighlighterPreTags("<div 
class='highlight'>").setHighlighterPostTags("</div>");
MultiSearchResponse sr = client.prepareMultiSearch()
    .add(srb1)
    .add(srb2)
    .execute().actionGet();

Thanks for any help you all can give!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a309df1d-77a7-4450-ae41-e286054e6bda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to