org.elasticsearch.action.get
Class GetResponse

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

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

The response of a get action.

See Also:
GetRequest, Client.get(GetRequest)

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
 
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()
           
 byte[] getSourceAsBytes()
          The source of the document if exists.
 BytesReference getSourceAsBytesRef()
          Returns bytes reference, also un compress the source if needed.
 String getSourceAsString()
           
 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.
 boolean isExists()
          Does the document exists.
 boolean isSourceEmpty()
          Is the source empty (not available) or not.
 Iterator<GetField> iterator()
           
 void readFrom(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)
           
 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
 

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.


getSourceAsBytes

public byte[] getSourceAsBytes()
The source of the document if exists.


sourceRef

public BytesReference sourceRef()
Returns bytes reference, also un compress the source if needed.


getSourceAsBytesRef

public BytesReference getSourceAsBytesRef()
Returns bytes reference, also un compress the source if needed.


isSourceEmpty

public boolean isSourceEmpty()
Is the source empty (not available) or not.


sourceAsString

public String sourceAsString()
The source of the document (as a string).


getSourceAsString

public String getSourceAsString()

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>

toXContent

public XContentBuilder toXContent(XContentBuilder builder,
                                  ToXContent.Params params)
                           throws IOException
Specified by:
toXContent in interface ToXContent
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.