public abstract class DocWriteResponse extends ReplicationResponse implements WriteResponse, StatusToXContentObject
Modifier and Type | Class and Description |
---|---|
static class |
DocWriteResponse.Builder
Base class of all
DocWriteResponse builders. |
static class |
DocWriteResponse.Result
An enum that represents the the results of CRUD operations, primarily used to communicate the type of
operation that occurred.
|
ReplicationResponse.ShardInfo
TransportResponse.Empty
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Modifier and Type | Field and Description |
---|---|
protected DocWriteResponse.Result |
result |
EMPTY
EMPTY_PARAMS
Modifier | Constructor and Description |
---|---|
protected |
DocWriteResponse() |
|
DocWriteResponse(ShardId shardId,
java.lang.String type,
java.lang.String id,
long seqNo,
long primaryTerm,
long version,
DocWriteResponse.Result result) |
Modifier and Type | Method and Description |
---|---|
boolean |
forcedRefresh()
Did this request force a refresh? Requests that set
WriteRequest.setRefreshPolicy(RefreshPolicy) to
WriteRequest.RefreshPolicy.IMMEDIATE will always return true for this. |
java.lang.String |
getId()
The id of the document changed.
|
java.lang.String |
getIndex()
The index the document was changed in.
|
java.lang.String |
getLocation(java.lang.String routing)
Return the relative URI for the location of the document suitable for use in the
Location header. |
long |
getPrimaryTerm()
The primary term for this change.
|
DocWriteResponse.Result |
getResult()
The change that occurred to the document.
|
long |
getSeqNo()
Returns the sequence number assigned for this change.
|
ShardId |
getShardId()
The exact shard the document was changed in.
|
java.lang.String |
getType()
The type of the document changed.
|
long |
getVersion()
Returns the current version of the doc.
|
XContentBuilder |
innerToXContent(XContentBuilder builder,
ToXContent.Params params) |
protected static void |
parseInnerToXContent(XContentParser parser,
DocWriteResponse.Builder context)
Parse the output of the
#innerToXContent(XContentBuilder, Params) method. |
void |
readFrom(StreamInput in)
Set this object's fields from a StreamInput.
|
void |
setForcedRefresh(boolean forcedRefresh)
Mark the response as having forced a refresh? Requests that set
WriteRequest.setRefreshPolicy(RefreshPolicy) to
WriteRequest.RefreshPolicy.IMMEDIATE should always mark this as true. |
RestStatus |
status()
returns the rest status for this response (based on
ShardInfo#status() |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
void |
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.
|
getShardInfo, setShardInfo
remoteAddress, remoteAddress
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isFragment
protected DocWriteResponse.Result result
public DocWriteResponse(ShardId shardId, java.lang.String type, java.lang.String id, long seqNo, long primaryTerm, long version, DocWriteResponse.Result result)
protected DocWriteResponse()
public DocWriteResponse.Result getResult()
public java.lang.String getIndex()
public ShardId getShardId()
public java.lang.String getType()
public java.lang.String getId()
public long getVersion()
public long getSeqNo()
SequenceNumbersService.UNASSIGNED_SEQ_NO
if the operation
wasn't performed (i.e., an update operation that resulted in a NOOP).public long getPrimaryTerm()
public boolean forcedRefresh()
WriteRequest.setRefreshPolicy(RefreshPolicy)
to
WriteRequest.RefreshPolicy.IMMEDIATE
will always return true for this. Requests that set it to WriteRequest.RefreshPolicy.WAIT_UNTIL
will
only return true here if they run out of refresh listener slots (see IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD
).public void setForcedRefresh(boolean forcedRefresh)
WriteResponse
WriteRequest.setRefreshPolicy(RefreshPolicy)
to
WriteRequest.RefreshPolicy.IMMEDIATE
should always mark this as true. Requests that set it to WriteRequest.RefreshPolicy.WAIT_UNTIL
will only
set this to true if they run out of refresh listener slots (see IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD
).setForcedRefresh
in interface WriteResponse
public RestStatus status()
ShardInfo#status()
status
in interface StatusToXContentObject
public java.lang.String getLocation(@Nullable java.lang.String routing)
Location
header. The use of relative URIs is
permitted as of HTTP/1.1 (cf. https://tools.ietf.org/html/rfc7231#section-7.1.2).routing
- custom routing or null
if custom routing is not usedpublic void readFrom(StreamInput in) throws java.io.IOException
Streamable
readFrom
in interface Streamable
readFrom
in class ReplicationResponse
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Streamable
writeTo
in interface Streamable
writeTo
in class ReplicationResponse
java.io.IOException
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
toXContent
in interface ToXContent
java.io.IOException
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
protected static void parseInnerToXContent(XContentParser parser, DocWriteResponse.Builder context) throws java.io.IOException
#innerToXContent(XContentBuilder, Params)
method.
This method is intended to be called by subclasses and must be called multiple times to parse all the information concerning
DocWriteResponse
objects. It always parses the current token, updates the given parsing context accordingly
if needed and then immediately returns.java.io.IOException