java.lang.Iterable<DocumentField>, Streamable, Writeable, ToXContent, ToXContentObjectpublic class GetResponse extends ActionResponse implements java.lang.Iterable<DocumentField>, ToXContentObject
GetRequest,
Client.get(GetRequest)ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsTransportResponse.EmptyWriteable.Reader<V>, Writeable.Writer<V>EMPTY_PARAMS| Constructor | Description |
|---|---|
GetResponse(GetResult getResult) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object o) |
|
static GetResponse |
fromXContent(XContentParser parser) |
This method can be used to parse a
GetResponse object when it has been printed out
as a xcontent using the toXContent(XContentBuilder, Params) method. |
DocumentField |
getField(java.lang.String name) |
|
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,java.lang.Object> |
getSource() |
|
byte[] |
getSourceAsBytes() |
The source of the document if exists.
|
BytesReference |
getSourceAsBytesRef() |
Returns bytes reference, also un compress the source if needed.
|
java.util.Map<java.lang.String,java.lang.Object> |
getSourceAsMap() |
The source of the document (As a map).
|
java.lang.String |
getSourceAsString() |
The source of the document (as a string).
|
BytesReference |
getSourceInternal() |
Returns the internal source bytes, as they are returned without munging (for example,
might still be compressed).
|
java.lang.String |
getType() |
The type of the document.
|
long |
getVersion() |
The version of the doc.
|
int |
hashCode() |
|
boolean |
isExists() |
Does the document exists.
|
boolean |
isSourceEmpty() |
Is the source empty (not available) or not.
|
java.util.Iterator<DocumentField> |
iterator() |
Deprecated.
Use
getSource() instead |
void |
readFrom(StreamInput in) |
Set this object's fields from a StreamInput.
|
java.lang.String |
toString() |
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
void |
writeTo(StreamOutput out) |
Write this object's fields to a StreamOutput.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitnewWriteableReaderisFragmentremoteAddress, remoteAddresspublic GetResponse(GetResult getResult)
public boolean isExists()
public java.lang.String getIndex()
public java.lang.String getType()
public java.lang.String getId()
public long getVersion()
public byte[] getSourceAsBytes()
public BytesReference getSourceInternal()
public BytesReference getSourceAsBytesRef()
public boolean isSourceEmpty()
public java.lang.String getSourceAsString()
public java.util.Map<java.lang.String,java.lang.Object> getSourceAsMap()
throws ElasticsearchParseException
ElasticsearchParseExceptionpublic java.util.Map<java.lang.String,java.lang.Object> getSource()
public java.util.Map<java.lang.String,DocumentField> getFields()
public DocumentField getField(java.lang.String name)
@Deprecated public java.util.Iterator<DocumentField> iterator()
getSource() insteaditerator in interface java.lang.Iterable<DocumentField>public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent in interface ToXContentjava.io.IOExceptionpublic static GetResponse fromXContent(XContentParser parser) throws java.io.IOException
GetResponse object when it has been printed out
as a xcontent using the toXContent(XContentBuilder, Params) method.
For forward compatibility reason this method might not fail if it tries to parse a field it
doesn't know. But before returning the result it will check that enough information were
parsed to return a valid GetResponse instance and throws a ParsingException
otherwise. This is the case when we get a 404 back, which can be parsed as a normal
GetResponse with found set to false, or as an elasticsearch exception. The caller
of this method needs a way to figure out whether we got back a valid get response, which
can be done by catching ParsingException.
parser - XContentParser to parse the response fromGetResponsejava.io.IOException - is an I/O exception occurs during the parsingpublic void readFrom(StreamInput in) throws java.io.IOException
StreamablereadFrom in interface StreamablereadFrom in class ActionResponsejava.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
StreamablewriteTo in interface StreamablewriteTo in interface WriteablewriteTo in class ActionResponsejava.io.IOExceptionpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object