Uploaded image for project: 'Spring Data Elasticsearch'
  1. Spring Data Elasticsearch
  2. DATAES-796

Provide new method to return SearchHits in ReactiveElasticsearchClient

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.2.6 (Moore SR6)
    • Fix Version/s: 4.1 GA (2020.0.0)
    • Component/s: None
    • Labels:
      None

      Description

      It is useful to get full information with the response (for example to get total hits).

      Currently, I have to make 2 requests (1 to get data and another for total)

       

      org.springframework.data.elasticsearch.client.reactive.DefaultReactiveElasticsearchClient#search

       

      @Override
      public Flux<SearchHit> search(HttpHeaders headers, SearchRequest searchRequest) {
      
         return sendRequest(searchRequest, RequestCreator.search(), SearchResponse.class, headers) //
               .map(SearchResponse::getHits)
               .flatMap(Flux::fromIterable); //here we lose a lot of usefull information
      }
      

       

       

      I think we should make another method with this signature:

       

      Mono<SearchHits> searchHits(HttpHeaders headers, SearchRequest searchRequest)

      p.s. I'm not sure about method name;

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sothawo sothawo
              Reporter:
              dserge.spb Dmitriy Sulimchuk
              Last updater:
              Spring Issues Spring Issues
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: