org.elasticsearch.search
Interface SearchHit

All Superinterfaces:
java.lang.Iterable<SearchHitField>, Streamable, ToXContent
All Known Implementing Classes:
InternalSearchHit

public interface SearchHit
extends Streamable, ToXContent, java.lang.Iterable<SearchHitField>

A single search hit.

See Also:
SearchHits

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.MapParams, ToXContent.Params
 
Field Summary
 
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
 
Method Summary
 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.lang.String[] getMatchedFilters()
          The set of filter names the query matched.
 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 getType()
          The type of the document.
 long getVersion()
          The version of the hit.
 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.
 boolean isSourceEmpty()
          Is the source empty (not available) or not.
 java.lang.String[] matchedFilters()
          The set of filter names the query matched.
 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).
 java.lang.String type()
          The type of the document.
 long version()
          The version of the hit.
 
Methods inherited from interface org.elasticsearch.common.io.stream.Streamable
readFrom, writeTo
 
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent
toXContent
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

score

float score()
The score.


getScore

float getScore()
The score.


index

java.lang.String index()
The index of the hit.


getIndex

java.lang.String getIndex()
The index of the hit.


id

java.lang.String id()
The id of the document.


getId

java.lang.String getId()
The id of the document.


type

java.lang.String type()
The type of the document.


getType

java.lang.String getType()
The type of the document.


version

long version()
The version of the hit.


getVersion

long getVersion()
The version of the hit.


source

byte[] source()
The source of the document (can be null).


isSourceEmpty

boolean isSourceEmpty()
Is the source empty (not available) or not.


getSource

java.util.Map<java.lang.String,java.lang.Object> getSource()
The source of the document as a map (can be null).


sourceAsString

java.lang.String sourceAsString()
The source of the document as string (can be null).


sourceAsMap

java.util.Map<java.lang.String,java.lang.Object> sourceAsMap()
                                                             throws ElasticSearchParseException
The source of the document as a map (can be null).

Throws:
ElasticSearchParseException

explanation

org.apache.lucene.search.Explanation explanation()
If enabled, the explanation of the search hit.


getExplanation

org.apache.lucene.search.Explanation getExplanation()
If enabled, the explanation of the search hit.


field

SearchHitField field(java.lang.String fieldName)
The hit field matching the given field name.


fields

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.


getFields

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.


highlightFields

java.util.Map<java.lang.String,HighlightField> highlightFields()
A map of highlighted fields.


getHighlightFields

java.util.Map<java.lang.String,HighlightField> getHighlightFields()
A map of highlighted fields.


sortValues

java.lang.Object[] sortValues()
An array of the sort values used.


getSortValues

java.lang.Object[] getSortValues()
An array of the sort values used.


matchedFilters

java.lang.String[] matchedFilters()
The set of filter names the query matched. Mainly makes sense for OR filters.


getMatchedFilters

java.lang.String[] getMatchedFilters()
The set of filter names the query matched. Mainly makes sense for OR filters.


shard

SearchShardTarget shard()
The shard of the search hit.


getShard

SearchShardTarget getShard()
The shard of the search hit.