Package org.elasticsearch.action
Class DocWriteResponse
java.lang.Object
- All Implemented Interfaces:
WriteResponse,Writeable,StatusToXContentObject,ToXContent,ToXContentObject
- Direct Known Subclasses:
DeleteResponse,IndexResponse,UpdateResponse
public abstract class DocWriteResponse extends ReplicationResponse implements WriteResponse, StatusToXContentObject
A base class for the response of a write operation that involves a single doc
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDocWriteResponse.BuilderBase class of allDocWriteResponsebuilders.static classDocWriteResponse.ResultAn enum that represents the results of CRUD operations, primarily used to communicate the type of operation that occurred.Nested classes/interfaces inherited from class org.elasticsearch.action.support.replication.ReplicationResponse
ReplicationResponse.ShardInfoNested classes/interfaces inherited from class org.elasticsearch.transport.TransportResponse
TransportResponse.EmptyNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields Modifier and Type Field Description protected DocWriteResponse.Resultresult -
Constructor Summary
Constructors Modifier Constructor Description protectedDocWriteResponse(StreamInput in)DocWriteResponse(ShardId shardId, java.lang.String type, java.lang.String id, long seqNo, long primaryTerm, long version, DocWriteResponse.Result result) -
Method Summary
Modifier and Type Method Description booleanforcedRefresh()Did this request force a refresh? Requests that setWriteRequest.setRefreshPolicy(RefreshPolicy)toWriteRequest.RefreshPolicy.IMMEDIATEwill always return true for this.java.lang.StringgetId()The id of the document changed.java.lang.StringgetIndex()The index the document was changed in.java.lang.StringgetLocation(java.lang.String routing)Return the relative URI for the location of the document suitable for use in theLocationheader.longgetPrimaryTerm()The primary term for this change.DocWriteResponse.ResultgetResult()The change that occurred to the document.longgetSeqNo()Returns the sequence number assigned for this change.ShardIdgetShardId()The exact shard the document was changed in.java.lang.StringgetType()Deprecated.Types are in the process of being removed.longgetVersion()Returns the current version of the doc.XContentBuilderinnerToXContent(XContentBuilder builder, ToXContent.Params params)protected static voidparseInnerToXContent(XContentParser parser, DocWriteResponse.Builder context)Parse the output of theinnerToXContent(XContentBuilder, Params)method.voidsetForcedRefresh(boolean forcedRefresh)Mark the response as having forced a refresh? Requests that setWriteRequest.setRefreshPolicy(RefreshPolicy)toWriteRequest.RefreshPolicy.IMMEDIATEshould always mark this as true.RestStatusstatus()returns the rest status for this response (based onReplicationResponse.ShardInfo.status()XContentBuildertoXContent(XContentBuilder builder, ToXContent.Params params)voidwriteTo(StreamOutput out)Write this into the StreamOutput.Methods inherited from class org.elasticsearch.action.support.replication.ReplicationResponse
getShardInfo, setShardInfoMethods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Field Details
-
Constructor Details
-
DocWriteResponse
public DocWriteResponse(ShardId shardId, java.lang.String type, java.lang.String id, long seqNo, long primaryTerm, long version, DocWriteResponse.Result result) -
DocWriteResponse
- Throws:
java.io.IOException
-
-
Method Details
-
getResult
The change that occurred to the document. -
getIndex
public java.lang.String getIndex()The index the document was changed in. -
getShardId
The exact shard the document was changed in. -
getType
@Deprecated public java.lang.String getType()Deprecated.Types are in the process of being removed.The type of the document changed. -
getId
public java.lang.String getId()The id of the document changed. -
getVersion
public long getVersion()Returns the current version of the doc. -
getSeqNo
public long getSeqNo()Returns the sequence number assigned for this change. ReturnsSequenceNumbers.UNASSIGNED_SEQ_NOif the operation wasn't performed (i.e., an update operation that resulted in a NOOP). -
getPrimaryTerm
public long getPrimaryTerm()The primary term for this change.- Returns:
- the primary term
-
forcedRefresh
public boolean forcedRefresh()Did this request force a refresh? Requests that setWriteRequest.setRefreshPolicy(RefreshPolicy)toWriteRequest.RefreshPolicy.IMMEDIATEwill always return true for this. Requests that set it toWriteRequest.RefreshPolicy.WAIT_UNTILwill only return true here if they run out of refresh listener slots (seeIndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD). -
setForcedRefresh
public void setForcedRefresh(boolean forcedRefresh)Description copied from interface:WriteResponseMark the response as having forced a refresh? Requests that setWriteRequest.setRefreshPolicy(RefreshPolicy)toWriteRequest.RefreshPolicy.IMMEDIATEshould always mark this as true. Requests that set it toWriteRequest.RefreshPolicy.WAIT_UNTILwill only set this to true if they run out of refresh listener slots (seeIndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD).- Specified by:
setForcedRefreshin interfaceWriteResponse
-
status
returns the rest status for this response (based onReplicationResponse.ShardInfo.status()- Specified by:
statusin interfaceStatusToXContentObject
-
getLocation
Return the relative URI for the location of the document suitable for use in theLocationheader. The use of relative URIs is permitted as of HTTP/1.1 (cf. https://tools.ietf.org/html/rfc7231#section-7.1.2).- Parameters:
routing- custom routing ornullif custom routing is not used- Returns:
- the relative URI for the location of the document
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classReplicationResponse- Throws:
java.io.IOException
-
toXContent
public final XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContentin interfaceToXContent- Throws:
java.io.IOException
-
innerToXContent
public XContentBuilder innerToXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Throws:
java.io.IOException
-
parseInnerToXContent
protected static void parseInnerToXContent(XContentParser parser, DocWriteResponse.Builder context) throws java.io.IOExceptionParse the output of theinnerToXContent(XContentBuilder, Params)method. This method is intended to be called by subclasses and must be called multiple times to parse all the information concerningDocWriteResponseobjects. It always parses the current token, updates the given parsing context accordingly if needed and then immediately returns.- Throws:
java.io.IOException
-