Package org.elasticsearch.index.get
Class GetResult
- java.lang.Object
-
- org.elasticsearch.index.get.GetResult
-
- All Implemented Interfaces:
Iterable<DocumentField>,Writeable,ToXContent,ToXContentObject
public class GetResult extends Object implements Writeable, Iterable<DocumentField>, ToXContentObject
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.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 Modifier and Type Field Description static String_IDstatic String_INDEXstatic String_TYPE-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description GetResult(String index, String type, String id, long seqNo, long primaryTerm, long version, boolean exists, BytesReference source, Map<String,DocumentField> documentFields, Map<String,DocumentField> metaFields)GetResult(StreamInput in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)DocumentFieldfield(String name)static GetResultfromXContent(XContentParser parser)static GetResultfromXContentEmbedded(XContentParser parser)static GetResultfromXContentEmbedded(XContentParser parser, String index, String type, String id)Map<String,DocumentField>getDocumentFields()Map<String,DocumentField>getFields()StringgetId()The id of the document.StringgetIndex()The index the document was fetched from.Map<String,DocumentField>getMetadataFields()longgetPrimaryTerm()The primary term of the last primary that has changed this document, if found.longgetSeqNo()The sequence number assigned to the last operation that has changed this document, if found.Map<String,Object>getSource()StringgetType()The type of the document.longgetVersion()The version of the doc.inthashCode()BytesReferenceinternalSourceRef()Internal source representation, might be compressed....booleanisExists()Does the document exist.booleanisSourceEmpty()Is the source empty (not available) or not.Iterator<DocumentField>iterator()byte[]source()The source of the document if exists.Map<String,Object>sourceAsMap()The source of the document (As a map).StringsourceAsString()The source of the document (as a string).BytesReferencesourceRef()Returns bytes reference, also un compress the source if needed.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)XContentBuildertoXContentEmbedded(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
_INDEX
public static final String _INDEX
- See Also:
- Constant Field Values
-
_TYPE
public static final String _TYPE
- See Also:
- Constant Field Values
-
_ID
public static final String _ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GetResult
public GetResult(StreamInput in) throws IOException
- Throws:
IOException
-
GetResult
public GetResult(String index, String type, String id, long seqNo, long primaryTerm, long version, boolean exists, BytesReference source, Map<String,DocumentField> documentFields, Map<String,DocumentField> metaFields)
-
-
Method Detail
-
isExists
public boolean isExists()
Does the document exist.
-
getIndex
public String getIndex()
The index the document was fetched from.
-
getType
public String getType()
The type of the document.
-
getId
public String getId()
The id of the document.
-
getVersion
public long getVersion()
The version of the doc.
-
getSeqNo
public long getSeqNo()
The sequence number assigned to the last operation that has changed this document, if found.
-
getPrimaryTerm
public long getPrimaryTerm()
The primary term of the last primary that has changed this document, if found.
-
source
public byte[] source()
The source of the document if exists.
-
sourceRef
public BytesReference sourceRef()
Returns bytes reference, also un compress the source if needed.
-
internalSourceRef
public BytesReference internalSourceRef()
Internal source representation, might be compressed....
-
isSourceEmpty
public boolean isSourceEmpty()
Is the source empty (not available) or not.
-
sourceAsString
public String sourceAsString()
The source of the document (as a string).
-
sourceAsMap
public Map<String,Object> sourceAsMap() throws ElasticsearchParseException
The source of the document (As a map).- Throws:
ElasticsearchParseException
-
getMetadataFields
public Map<String,DocumentField> getMetadataFields()
-
getDocumentFields
public Map<String,DocumentField> getDocumentFields()
-
getFields
public Map<String,DocumentField> getFields()
-
field
public DocumentField field(String name)
-
iterator
public Iterator<DocumentField> iterator()
- Specified by:
iteratorin interfaceIterable<DocumentField>
-
toXContentEmbedded
public XContentBuilder toXContentEmbedded(XContentBuilder builder, ToXContent.Params params) throws IOException
- Throws:
IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-
fromXContentEmbedded
public static GetResult fromXContentEmbedded(XContentParser parser) throws IOException
- Throws:
IOException
-
fromXContentEmbedded
public static GetResult fromXContentEmbedded(XContentParser parser, String index, String type, String id) throws IOException
- Throws:
IOException
-
fromXContent
public static GetResult fromXContent(XContentParser parser) throws IOException
- Throws:
IOException
-
writeTo
public void writeTo(StreamOutput out) throws IOException
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
-