Class GetResult

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

public class GetResult extends Object implements Writeable, Iterable<DocumentField>, org.elasticsearch.common.xcontent.ToXContentObject
  • Field Details

  • Constructor Details

  • Method Details

    • 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
    • getSource

      public Map<String,Object> getSource()
    • 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:
      iterator in interface Iterable<DocumentField>
    • toXContentEmbedded

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

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

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

      public static GetResult fromXContentEmbedded(org.elasticsearch.common.xcontent.XContentParser parser, String index, String type, String id) throws IOException
      Throws:
      IOException
    • fromXContent

      public static GetResult fromXContent(org.elasticsearch.common.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • writeTo

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object