Class SearchHitsImpl<T>
java.lang.Object
org.springframework.data.elasticsearch.core.SearchHitsImpl<T>
- Type Parameters:
T- the result data class.
- All Implemented Interfaces:
Iterable<SearchHit<T>>, Supplier<Stream<SearchHit<T>>>, SearchHits<T>, SearchScrollHits<T>, Streamable<SearchHit<T>>
Basic implementation of
SearchScrollHits- Since:
- 4.0
- Author:
- Peter-Josef Meisch, Sascha Woo, Haibo Liu, Mohamed El Harrougui
-
Constructor Summary
ConstructorsConstructorDescriptionSearchHitsImpl(long totalHits, TotalHitsRelation totalHitsRelation, float maxScore, Duration executionDuration, @Nullable String scrollId, @Nullable String pointInTimeId, List<? extends SearchHit<T>> searchHits, @Nullable AggregationsContainer<?> aggregations, @Nullable Suggest suggest, @Nullable SearchShardStatistics searchShardStatistics) -
Method Summary
Modifier and TypeMethodDescription@Nullable AggregationsContainer<?> float@Nullable StringWhen doing a search with a point in time, the response contains a new point in time id value.@Nullable StringgetSearchHit(int index) @Nullable SuggestlongtoString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface SearchHits
hasAggregations, hasSearchHits, hasSuggest, iterator
-
Constructor Details
-
SearchHitsImpl
public SearchHitsImpl(long totalHits, TotalHitsRelation totalHitsRelation, float maxScore, Duration executionDuration, @Nullable String scrollId, @Nullable String pointInTimeId, List<? extends SearchHit<T>> searchHits, @Nullable AggregationsContainer<?> aggregations, @Nullable Suggest suggest, @Nullable SearchShardStatistics searchShardStatistics) - Parameters:
totalHits- the number of total hits for the searchtotalHitsRelation- the relation , must not be nullmaxScore- the maximum scoreexecutionDuration- the execution duration it took to complete the requestscrollId- the scroll id if availablesearchHits- must not be nullaggregations- the aggregations if available
-
-
Method Details
-
getTotalHits
public long getTotalHits()- Specified by:
getTotalHitsin interfaceSearchHits<T>- Returns:
- the number of total hits.
-
getTotalHitsRelation
- Specified by:
getTotalHitsRelationin interfaceSearchHits<T>- Returns:
- the relation for the total hits
-
getMaxScore
public float getMaxScore()- Specified by:
getMaxScorein interfaceSearchHits<T>- Returns:
- the maximum score
-
getExecutionDuration
- Specified by:
getExecutionDurationin interfaceSearchHits<T>- Returns:
- the execution duration it took to complete the request
-
getScrollId
- Specified by:
getScrollIdin interfaceSearchScrollHits<T>- Returns:
- the scroll id
-
getSearchHits
- Specified by:
getSearchHitsin interfaceSearchHits<T>- Returns:
- the contained
SearchHits.
-
getSearchHit
- Specified by:
getSearchHitin interfaceSearchHits<T>- Parameters:
index- position in List.- Returns:
- the
SearchHitat position {index}
-
getAggregations
- Specified by:
getAggregationsin interfaceSearchHits<T>- Returns:
- the aggregations.
-
getSuggest
- Specified by:
getSuggestin interfaceSearchHits<T>- Returns:
- the suggest response
-
getPointInTimeId
Description copied from interface:SearchHitsWhen doing a search with a point in time, the response contains a new point in time id value.- Specified by:
getPointInTimeIdin interfaceSearchHits<T>- Returns:
- the new point in time id, if one was returned from Elasticsearch
-
getSearchShardStatistics
- Specified by:
getSearchShardStatisticsin interfaceSearchHits<T>- Returns:
- shard statistics for the search hit.
-
toString
-