Package org.elasticsearch.index.get
Class GetResult
- java.lang.Object
-
- org.elasticsearch.index.get.GetResult
-
- All Implemented Interfaces:
java.lang.Iterable<DocumentField>,Streamable,ToXContent,ToXContentObject
public class GetResult extends java.lang.Object implements Streamable, java.lang.Iterable<DocumentField>, ToXContentObject
-
-
Nested Class Summary
-
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 java.lang.String_IDstatic java.lang.String_INDEXstatic java.lang.String_TYPE-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description GetResult(java.lang.String index, java.lang.String type, java.lang.String id, long seqNo, long primaryTerm, long version, boolean exists, BytesReference source, java.util.Map<java.lang.String,DocumentField> documentFields, java.util.Map<java.lang.String,DocumentField> metaFields)
-
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)DocumentFieldfield(java.lang.String name)static GetResultfromXContent(XContentParser parser)static GetResultfromXContentEmbedded(XContentParser parser)static GetResultfromXContentEmbedded(XContentParser parser, java.lang.String index, java.lang.String type, java.lang.String id)java.util.Map<java.lang.String,DocumentField>getDocumentFields()java.util.Map<java.lang.String,DocumentField>getFields()java.lang.StringgetId()The id of the document.java.lang.StringgetIndex()The index the document was fetched from.java.util.Map<java.lang.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.java.util.Map<java.lang.String,java.lang.Object>getSource()java.lang.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.java.util.Iterator<DocumentField>iterator()voidreadFrom(StreamInput in)Set this object's fields from a StreamInput.static GetResultreadGetResult(StreamInput in)byte[]source()The source of the document if exists.java.util.Map<java.lang.String,java.lang.Object>sourceAsMap()The source of the document (As a map).java.lang.StringsourceAsString()The source of the document (as a string).BytesReferencesourceRef()Returns bytes reference, also un compress the source if needed.java.lang.StringtoString()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)XContentBuildertoXContentEmbedded(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, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Field Detail
-
_INDEX
public static final java.lang.String _INDEX
- See Also:
- Constant Field Values
-
_TYPE
public static final java.lang.String _TYPE
- See Also:
- Constant Field Values
-
_ID
public static final java.lang.String _ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GetResult
public GetResult(java.lang.String index, java.lang.String type, java.lang.String id, long seqNo, long primaryTerm, long version, boolean exists, BytesReference source, java.util.Map<java.lang.String,DocumentField> documentFields, java.util.Map<java.lang.String,DocumentField> metaFields)
-
-
Method Detail
-
isExists
public boolean isExists()
Does the document exist.
-
getIndex
public java.lang.String getIndex()
The index the document was fetched from.
-
getType
public java.lang.String getType()
The type of the document.
-
getId
public java.lang.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 java.lang.String sourceAsString()
The source of the document (as a string).
-
sourceAsMap
public java.util.Map<java.lang.String,java.lang.Object> sourceAsMap() throws ElasticsearchParseExceptionThe source of the document (As a map).- Throws:
ElasticsearchParseException
-
getSource
public java.util.Map<java.lang.String,java.lang.Object> getSource()
-
getMetadataFields
public java.util.Map<java.lang.String,DocumentField> getMetadataFields()
-
getDocumentFields
public java.util.Map<java.lang.String,DocumentField> getDocumentFields()
-
getFields
public java.util.Map<java.lang.String,DocumentField> getFields()
-
field
public DocumentField field(java.lang.String name)
-
iterator
public java.util.Iterator<DocumentField> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<DocumentField>
-
toXContentEmbedded
public XContentBuilder toXContentEmbedded(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Throws:
java.io.IOException
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
fromXContentEmbedded
public static GetResult fromXContentEmbedded(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
fromXContentEmbedded
public static GetResult fromXContentEmbedded(XContentParser parser, java.lang.String index, java.lang.String type, java.lang.String id) throws java.io.IOException
- Throws:
java.io.IOException
-
fromXContent
public static GetResult fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
readGetResult
public static GetResult readGetResult(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 o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-