Package org.elasticsearch.search
Class SearchHits
java.lang.Object
org.elasticsearch.search.SearchHits
- All Implemented Interfaces:
Iterable<SearchHit>
,Writeable
,ToXContent
,ToXContentFragment
public final class SearchHits
extends Object
implements Writeable, ToXContentFragment, Iterable<SearchHit>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
ConstructorDescriptionSearchHits
(SearchHit[] hits, org.apache.lucene.search.TotalHits totalHits, float maxScore) SearchHits
(SearchHit[] hits, org.apache.lucene.search.TotalHits totalHits, float maxScore, org.apache.lucene.search.SortField[] sortFields, String collapseField, Object[] collapseValues) -
Method Summary
Modifier and TypeMethodDescriptionstatic SearchHits
empty()
static SearchHits
empty
(boolean withTotalHits) boolean
static SearchHits
fromXContent
(XContentParser parser) getAt
(int position) Return the hit as the provided position.In case field collapsing was performed, returns the field used for field collapsing, null otherwiseObject[]
In case field collapsing was performed, returns the values of the field that field collapsing was performed on, null otherwisegetHits()
The hits of the search request (based on the search type, and from / size provided).float
The maximum score of this query.org.apache.lucene.search.SortField[]
In case documents were sorted by field(s), returns information about such field(s), null otherwiseorg.apache.lucene.search.TotalHits
The total number of hits for the query or null if the tracking of total hits is disabled in the request.int
hashCode()
iterator()
static org.apache.lucene.search.TotalHits
parseTotalHitsFragment
(XContentParser parser) toXContent
(XContentBuilder builder, ToXContent.Params params) void
writeTo
(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.elasticsearch.xcontent.ToXContentFragment
isFragment
-
Field Details
-
EMPTY
-
-
Constructor Details
-
SearchHits
-
SearchHits
-
SearchHits
- Throws:
IOException
-
-
Method Details
-
empty
-
empty
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in interfaceWriteable
- Throws:
IOException
-
getTotalHits
The total number of hits for the query or null if the tracking of total hits is disabled in the request. -
getMaxScore
public float getMaxScore()The maximum score of this query. -
getHits
The hits of the search request (based on the search type, and from / size provided). -
getAt
Return the hit as the provided position. -
getSortFields
In case documents were sorted by field(s), returns information about such field(s), null otherwise- See Also:
-
SortField
-
getCollapseField
In case field collapsing was performed, returns the field used for field collapsing, null otherwise -
getCollapseValues
In case field collapsing was performed, returns the values of the field that field collapsing was performed on, null otherwise -
iterator
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContent
in interfaceToXContent
- Throws:
IOException
-
fromXContent
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
parseTotalHitsFragment
public static org.apache.lucene.search.TotalHits parseTotalHitsFragment(XContentParser parser) throws IOException - Throws:
IOException
-