Class GetResult

java.lang.Object
org.elasticsearch.index.get.GetResult
All Implemented Interfaces:
java.lang.Iterable<DocumentField>, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject

public class GetResult
extends java.lang.Object
implements Writeable, java.lang.Iterable<DocumentField>, org.elasticsearch.common.xcontent.ToXContentObject
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.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 java.lang.String _ID  
    static java.lang.String _INDEX  
    static 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)  
    GetResult​(StreamInput in)  
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    DocumentField field​(java.lang.String name)  
    static GetResult fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser)  
    static GetResult fromXContentEmbedded​(org.elasticsearch.common.xcontent.XContentParser parser)  
    static GetResult fromXContentEmbedded​(org.elasticsearch.common.xcontent.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.String getId()
    The id of the document.
    java.lang.String getIndex()
    The index the document was fetched from.
    java.util.Map<java.lang.String,​DocumentField> getMetadataFields()  
    long getPrimaryTerm()
    The primary term of the last primary that has changed this document, if found.
    long getSeqNo()
    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.String getType()
    The type of the document.
    long getVersion()
    The version of the doc.
    int hashCode()  
    BytesReference internalSourceRef()
    Internal source representation, might be compressed....
    boolean isExists()
    Does the document exist.
    boolean isSourceEmpty()
    Is the source empty (not available) or not.
    java.util.Iterator<DocumentField> iterator()  
    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.String sourceAsString()
    The source of the document (as a string).
    BytesReference sourceRef()
    Returns bytes reference, also un compress the source if needed.
    java.lang.String toString()  
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    org.elasticsearch.common.xcontent.XContentBuilder toXContentEmbedded​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    void writeTo​(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 Details

  • Constructor Details

    • GetResult

      public GetResult​(StreamInput in) throws java.io.IOException
      Throws:
      java.io.IOException
    • 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 Details

    • 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 ElasticsearchParseException
      The 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:
      iterator in interface java.lang.Iterable<DocumentField>
    • toXContentEmbedded

      public org.elasticsearch.common.xcontent.XContentBuilder toXContentEmbedded​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • fromXContentEmbedded

      public static GetResult fromXContentEmbedded​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Throws:
      java.io.IOException
    • fromXContentEmbedded

      public static GetResult fromXContentEmbedded​(org.elasticsearch.common.xcontent.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​(org.elasticsearch.common.xcontent.XContentParser parser) throws java.io.IOException
      Throws:
      java.io.IOException
    • writeTo

      public void writeTo​(StreamOutput out) throws java.io.IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      java.io.IOException
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object