public interface SearchHit extends Streamable, ToXContent, java.lang.Iterable<SearchHitField>
SearchHits
Modifier and Type | Interface and Description |
---|---|
static interface |
SearchHit.NestedIdentity
Encapsulates the nested identity of a hit.
|
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
EMPTY_PARAMS
Modifier and Type | Method and Description |
---|---|
org.apache.lucene.search.Explanation |
explanation()
If enabled, the explanation of the search hit.
|
SearchHitField |
field(java.lang.String fieldName)
The hit field matching the given field name.
|
java.util.Map<java.lang.String,SearchHitField> |
fields()
A map of hit fields (from field name to hit fields) if additional fields
were required to be loaded.
|
org.apache.lucene.search.Explanation |
getExplanation()
If enabled, the explanation of the search hit.
|
java.util.Map<java.lang.String,SearchHitField> |
getFields()
A map of hit fields (from field name to hit fields) if additional fields
were required to be loaded.
|
java.util.Map<java.lang.String,HighlightField> |
getHighlightFields()
A map of highlighted fields.
|
java.lang.String |
getId()
The id of the document.
|
java.lang.String |
getIndex()
The index of the hit.
|
java.util.Map<java.lang.String,SearchHits> |
getInnerHits() |
java.lang.String[] |
getMatchedQueries()
The set of query and filter names the query matched with.
|
SearchHit.NestedIdentity |
getNestedIdentity()
If this is a nested hit then nested reference information is returned otherwise
null is returned. |
float |
getScore()
The score.
|
SearchShardTarget |
getShard()
The shard of the search hit.
|
java.lang.Object[] |
getSortValues()
An array of the sort values used.
|
java.util.Map<java.lang.String,java.lang.Object> |
getSource()
The source of the document as a map (can be null).
|
java.lang.String |
getSourceAsString()
The source of the document as string (can be null).
|
BytesReference |
getSourceRef()
Returns bytes reference, also un compress the source if needed.
|
java.lang.String |
getType()
The type of the document.
|
long |
getVersion()
The version of the hit.
|
boolean |
hasSource()
Is the source available or not.
|
java.util.Map<java.lang.String,HighlightField> |
highlightFields()
A map of highlighted fields.
|
java.lang.String |
id()
The id of the document.
|
java.lang.String |
index()
The index of the hit.
|
java.lang.String[] |
matchedQueries()
The set of query and filter names the query matched with.
|
float |
score()
The score.
|
SearchShardTarget |
shard()
The shard of the search hit.
|
java.lang.Object[] |
sortValues()
An array of the sort values used.
|
byte[] |
source()
The source of the document (can be null).
|
java.util.Map<java.lang.String,java.lang.Object> |
sourceAsMap()
The source of the document as a map (can be null).
|
java.lang.String |
sourceAsString()
The source of the document as string (can be null).
|
BytesReference |
sourceRef()
Returns bytes reference, also un compress the source if needed.
|
java.lang.String |
type()
The type of the document.
|
long |
version()
The version of the hit.
|
readFrom, writeTo
toXContent
float score()
float getScore()
java.lang.String index()
java.lang.String getIndex()
java.lang.String id()
java.lang.String getId()
java.lang.String type()
java.lang.String getType()
SearchHit.NestedIdentity getNestedIdentity()
null
is returned.long version()
long getVersion()
BytesReference sourceRef()
BytesReference getSourceRef()
byte[] source()
sourceRef()
so there won't be a need to copy.boolean hasSource()
fields
doesn't contain
_source
or if source is disabled in the mapping.java.util.Map<java.lang.String,java.lang.Object> getSource()
java.lang.String sourceAsString()
java.lang.String getSourceAsString()
java.util.Map<java.lang.String,java.lang.Object> sourceAsMap() throws ElasticsearchParseException
ElasticsearchParseException
org.apache.lucene.search.Explanation explanation()
org.apache.lucene.search.Explanation getExplanation()
SearchHitField field(java.lang.String fieldName)
java.util.Map<java.lang.String,SearchHitField> fields()
java.util.Map<java.lang.String,SearchHitField> getFields()
java.util.Map<java.lang.String,HighlightField> highlightFields()
java.util.Map<java.lang.String,HighlightField> getHighlightFields()
java.lang.Object[] sortValues()
java.lang.Object[] getSortValues()
java.lang.String[] matchedQueries()
java.lang.String[] getMatchedQueries()
SearchShardTarget shard()
SearchShardTarget getShard()
java.util.Map<java.lang.String,SearchHits> getInnerHits()
null
if there are none