org.elasticsearch.index.get
Class GetResult

java.lang.Object
  extended by org.elasticsearch.index.get.GetResult
All Implemented Interfaces:
Iterable<GetField>, Streamable, ToXContent

public class GetResult
extends Object
implements Streamable, Iterable<GetField>, ToXContent


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
 
Constructor Summary
GetResult(String index, String type, String id, long version, boolean exists, BytesReference source, Map<String,GetField> fields)
           
 
Method Summary
 boolean exists()
          Does the document exists.
 GetField field(String name)
           
 Map<String,GetField> fields()
           
 Map<String,GetField> getFields()
           
 String getId()
          The id of the document.
 String getIndex()
          The index the document was fetched from.
 Map<String,Object> getSource()
           
 String getType()
          The type of the document.
 long getVersion()
          The version of the doc.
 String id()
          The id of the document.
 String index()
          The index the document was fetched from.
 BytesReference internalSourceRef()
          Internal source representation, might be compressed....
 boolean isExists()
          Does the document exists.
 boolean isSourceEmpty()
          Is the source empty (not available) or not.
 Iterator<GetField> iterator()
           
 void readFrom(StreamInput in)
           
static GetResult readGetResult(StreamInput in)
           
 byte[] source()
          The source of the document if exists.
 Map<String,Object> sourceAsMap()
          The source of the document (As a map).
 String sourceAsString()
          The source of the document (as a string).
 BytesReference sourceRef()
          Returns bytes reference, also un compress the source if needed.
 XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params)
           
 XContentBuilder toXContentEmbedded(XContentBuilder builder, ToXContent.Params params)
           
 String type()
          The type of the document.
 long version()
          The version of the doc.
 void writeTo(StreamOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetResult

public GetResult(String index,
                 String type,
                 String id,
                 long version,
                 boolean exists,
                 BytesReference source,
                 Map<String,GetField> fields)
Method Detail

exists

public boolean exists()
Does the document exists.


isExists

public boolean isExists()
Does the document exists.


index

public String index()
The index the document was fetched from.


getIndex

public String getIndex()
The index the document was fetched from.


type

public String type()
The type of the document.


getType

public String getType()
The type of the document.


id

public String id()
The id of the document.


getId

public String getId()
The id of the document.


version

public long version()
The version of the doc.


getVersion

public long getVersion()
The version of the doc.


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()

fields

public Map<String,GetField> fields()

getFields

public Map<String,GetField> getFields()

field

public GetField field(String name)

iterator

public Iterator<GetField> iterator()
Specified by:
iterator in interface Iterable<GetField>

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:
toXContent in interface ToXContent
Throws:
IOException

readGetResult

public static GetResult readGetResult(StreamInput in)
                               throws IOException
Throws:
IOException

readFrom

public void readFrom(StreamInput in)
              throws IOException
Specified by:
readFrom in interface Streamable
Throws:
IOException

writeTo

public void writeTo(StreamOutput out)
             throws IOException
Specified by:
writeTo in interface Streamable
Throws:
IOException


Copyright © 2009-2012. All Rights Reserved.