Package org.elasticsearch.search
Class SearchHits
- java.lang.Object
-
- org.elasticsearch.search.SearchHits
-
- All Implemented Interfaces:
java.lang.Iterable<SearchHit>,Streamable,ToXContent,ToXContentFragment
public final class SearchHits extends java.lang.Object implements Streamable, ToXContentFragment, java.lang.Iterable<SearchHit>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSearchHits.Fields-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
-
Field Summary
Fields Modifier and Type Field Description static SearchHit[]EMPTYlongtotalHits-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description SearchHits(SearchHit[] hits, long totalHits, float maxScore)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SearchHitsempty()booleanequals(java.lang.Object obj)static SearchHitsfromXContent(XContentParser parser)SearchHitgetAt(int position)Return the hit as the provided position.SearchHit[]getHits()The hits of the search request (based on the search type, and from / size provided).floatgetMaxScore()The maximum score of this query.longgetTotalHits()The total number of hits that matches the search request.inthashCode()java.util.Iterator<SearchHit>iterator()voidreadFrom(StreamInput in)Set this object's fields from a StreamInput.static SearchHitsreadSearchHits(StreamInput in)XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this object's fields to a StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.io.stream.Streamable
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
-
-
-
Field Detail
-
EMPTY
public static final SearchHit[] EMPTY
-
totalHits
public long totalHits
-
-
Constructor Detail
-
SearchHits
public SearchHits(SearchHit[] hits, long totalHits, float maxScore)
-
-
Method Detail
-
empty
public static SearchHits empty()
-
getTotalHits
public long getTotalHits()
The total number of hits that matches the search request.
-
getMaxScore
public float getMaxScore()
The maximum score of this query.
-
getHits
public SearchHit[] getHits()
The hits of the search request (based on the search type, and from / size provided).
-
getAt
public SearchHit getAt(int position)
Return the hit as the provided position.
-
iterator
public java.util.Iterator<SearchHit> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<SearchHit>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
fromXContent
public static SearchHits fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
readSearchHits
public static SearchHits readSearchHits(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:StreamableSet this object's fields from a StreamInput.- Specified by:
readFromin interfaceStreamable- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:StreamableWrite this object's fields to a StreamOutput.- Specified by:
writeToin interfaceStreamable- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-