Class SearchResponseUtil
java.lang.Object
org.opensearch.search.pipeline.common.helpers.SearchResponseUtil
Helper methods for manipulating
SearchResponse.-
Method Summary
Modifier and TypeMethodDescriptionstatic SearchResponsereplaceHits(SearchHit[] newHits, SearchResponse response) Convenience method when only replacing theSearchHitarray within theSearchHitsin aSearchResponse.static SearchResponsereplaceHits(SearchHits newHits, SearchResponse response) Construct a newSearchResponsebased on an existing one, replacing just theSearchHits.
-
Method Details
-
replaceHits
Construct a newSearchResponsebased on an existing one, replacing just theSearchHits.- Parameters:
newHits- newSearchHitsresponse- the existing search response- Returns:
- a new search response where the
SearchHitshas been replaced
-
replaceHits
Convenience method when only replacing theSearchHitarray within theSearchHitsin aSearchResponse.- Parameters:
newHits- the new array ofSearchHitelements.response- the search response to update- Returns:
- a
SearchResponsewhere the underlying array ofSearchHitwithin theSearchHitshas been replaced.
-