Interface SearchHits<T>

Type Parameters:
T - the result data class.
All Superinterfaces:
Iterable<SearchHit<T>>, Streamable<SearchHit<T>>, Supplier<Stream<SearchHit<T>>>
All Known Subinterfaces:
SearchScrollHits<T>
All Known Implementing Classes:
SearchHitsImpl

public interface SearchHits<T> extends Streamable<SearchHit<T>>
Encapsulates a list of SearchHits with additional information from the search.
Since:
4.0
Author:
Sascha Woo
  • Method Details

    • getAggregations

      @Nullable AggregationsContainer<?> getAggregations()
      Returns:
      the aggregations.
    • getMaxScore

      float getMaxScore()
      Returns:
      the maximum score
    • getSearchHit

      SearchHit<T> getSearchHit(int index)
      Parameters:
      index - position in List.
      Returns:
      the SearchHit at position {index}
      Throws:
      IndexOutOfBoundsException - on invalid index
    • getSearchHits

      List<SearchHit<T>> getSearchHits()
      Returns:
      the contained SearchHits.
    • getTotalHits

      long getTotalHits()
      Returns:
      the number of total hits.
    • getTotalHitsRelation

      TotalHitsRelation getTotalHitsRelation()
      Returns:
      the relation for the total hits
    • hasAggregations

      default boolean hasAggregations()
      Returns:
      true if aggregations are available
    • hasSearchHits

      default boolean hasSearchHits()
      Returns:
      whether the SearchHits has search hits.
    • getSuggest

      @Nullable Suggest getSuggest()
      Returns:
      the suggest response
      Since:
      4.3
    • hasSuggest

      default boolean hasSuggest()
      Returns:
      wether the SearchHits has a suggest response.
      Since:
      4.3
    • iterator

      default Iterator<SearchHit<T>> iterator()
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      an iterator for SearchHit
    • getPointInTimeId

      @Nullable String getPointInTimeId()
      When doing a search with a point in time, the response contains a new point in time id value.
      Returns:
      the new point in time id, if one was returned from Elasticsearch
      Since:
      5.0