Package org.elasticsearch.action
Class DocWriteResponse
- All Implemented Interfaces:
WriteResponse,Writeable,StatusToXContentObject,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentObject,org.elasticsearch.core.RefCounted
- 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 ClassesModifier and TypeClassDescriptionstatic classBase class of allDocWriteResponsebuilders.static classAn 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.action.ActionResponse
ActionResponse.EmptyNested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from class org.elasticsearch.action.support.replication.ReplicationResponse
EMPTYFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNeeded for deserialization of single item requests inIndexActionand BwC deserialization pathDocWriteResponse(ShardId shardId, String type, String id, long seqNo, long primaryTerm, long version, DocWriteResponse.Result result)protectedDocWriteResponse(ShardId shardId, StreamInput in) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDid this request force a refresh? Requests that setWriteRequest.setRefreshPolicy(RefreshPolicy)toWriteRequest.RefreshPolicy.IMMEDIATEwill always return true for this.getId()The id of the document changed.getIndex()The index the document was changed in.getLocation(String routing)Return the relative URI for the location of the document suitable for use in theLocationheader.longThe primary term for this change.The change that occurred to the document.longgetSeqNo()Returns the sequence number assigned for this change.The exact shard the document was changed in.getType()Deprecated.Types are in the process of being removed.longReturns the current version of the doc.org.elasticsearch.common.xcontent.XContentBuilderinnerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)protected static voidparseInnerToXContent(org.elasticsearch.common.xcontent.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.status()returns the rest status for this response (based onReplicationResponse.ShardInfo.status()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)voidwriteThin(StreamOutput out)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
decRef, incRef, remoteAddress, remoteAddress, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
Field Details
-
result
-
-
Constructor Details
-
DocWriteResponse
public DocWriteResponse(ShardId shardId, String type, String id, long seqNo, long primaryTerm, long version, DocWriteResponse.Result result) -
DocWriteResponse
- Throws:
IOException
-
DocWriteResponse
Needed for deserialization of single item requests inIndexActionand BwC deserialization path- Throws:
IOException
-
-
Method Details
-
getResult
The change that occurred to the document. -
getIndex
The index the document was changed in. -
getShardId
The exact shard the document was changed in. -
getType
Deprecated.Types are in the process of being removed.The type of the document changed. -
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
-
writeThin
- Throws:
IOException
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Overrides:
writeToin classReplicationResponse- Throws:
IOException
-
toXContent
public final org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
IOException
-
innerToXContent
public org.elasticsearch.common.xcontent.XContentBuilder innerToXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Throws:
IOException
-
parseInnerToXContent
protected static void parseInnerToXContent(org.elasticsearch.common.xcontent.XContentParser parser, DocWriteResponse.Builder context) throws 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:
IOException
-