IndicesRequest, RealtimeRequest, Streamable, Writeable, TaskAwareRequestpublic class GetRequest extends SingleShardRequest<GetRequest> implements RealtimeRequest
Requests.getRequest(String).
The operation requires the SingleShardRequest.index(), type(String) and id(String)
to be set.
IndicesRequest.ReplaceableTransportRequest.EmptyWriteable.Reader<V>, Writeable.Writer<V>index, INDICES_OPTIONS| Constructor | Description |
|---|---|
GetRequest() |
|
GetRequest(java.lang.String index) |
Constructs a new get request against the specified index.
|
GetRequest(java.lang.String index,
java.lang.String type,
java.lang.String id) |
Constructs a new get request against the specified index with the type and id.
|
| Modifier and Type | Method | Description |
|---|---|---|
FetchSourceContext |
fetchSourceContext() |
|
GetRequest |
fetchSourceContext(FetchSourceContext context) |
Allows setting the
FetchSourceContext for this request, controlling if and how _source should be returned. |
java.lang.String |
id() |
|
GetRequest |
id(java.lang.String id) |
Sets the id of the document to fetch.
|
java.lang.String |
parent() |
|
GetRequest |
parent(java.lang.String parent) |
Sets the parent id of this document.
|
java.lang.String |
preference() |
|
GetRequest |
preference(java.lang.String preference) |
Sets the preference to execute the search.
|
void |
readFrom(StreamInput in) |
Set this object's fields from a StreamInput.
|
boolean |
realtime() |
|
GetRequest |
realtime(boolean realtime) |
|
boolean |
refresh() |
|
GetRequest |
refresh(boolean refresh) |
Should a refresh be executed before this get operation causing the operation to
return the latest value.
|
java.lang.String |
routing() |
|
GetRequest |
routing(java.lang.String routing) |
Controls the shard routing of the request.
|
java.lang.String[] |
storedFields() |
Explicitly specify the stored fields that will be returned.
|
GetRequest |
storedFields(java.lang.String... fields) |
Explicitly specify the stored fields that will be returned.
|
java.lang.String |
toString() |
|
java.lang.String |
type() |
|
GetRequest |
type(java.lang.String type) |
Sets the type of the document to fetch.
|
ActionRequestValidationException |
validate() |
|
long |
version() |
Sets the version, which will cause the get operation to only be performed if a matching
version exists and no changes happened on the doc since then.
|
GetRequest |
version(long version) |
|
VersionType |
versionType() |
|
GetRequest |
versionType(VersionType versionType) |
Sets the versioning type.
|
void |
writeTo(StreamOutput out) |
Write this object's fields to a StreamOutput.
|
getShouldStoreResultclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitindex, index, indices, indicesOptions, validateNonNullIndexnewWriteableReadercreateTask, getDescription, setParentTaskremoteAddress, remoteAddressgetParentTask, setParentTaskpublic GetRequest()
public GetRequest(java.lang.String index)
type(String) and id(String)
must be set.public GetRequest(java.lang.String index,
java.lang.String type,
java.lang.String id)
index - The index to get the document fromtype - The type of the documentid - The id of the documentpublic ActionRequestValidationException validate()
validate in class ActionRequestpublic GetRequest type(@Nullable java.lang.String type)
public GetRequest id(java.lang.String id)
public java.lang.String parent()
public GetRequest parent(java.lang.String parent)
public GetRequest routing(java.lang.String routing)
public GetRequest preference(java.lang.String preference)
public java.lang.String type()
public java.lang.String id()
public java.lang.String routing()
public java.lang.String preference()
public GetRequest fetchSourceContext(FetchSourceContext context)
FetchSourceContext for this request, controlling if and how _source should be returned.public FetchSourceContext fetchSourceContext()
public GetRequest storedFields(java.lang.String... fields)
public java.lang.String[] storedFields()
public GetRequest refresh(boolean refresh)
public boolean refresh()
public boolean realtime()
public GetRequest realtime(boolean realtime)
realtime in interface RealtimeRequestrealtime - Controls whether this request should be realtime by reading from the translog.public long version()
public GetRequest version(long version)
public GetRequest versionType(VersionType versionType)
VersionType.INTERNAL.public VersionType versionType()
public void readFrom(StreamInput in) throws java.io.IOException
StreamablereadFrom in interface StreamablereadFrom in class SingleShardRequest<GetRequest>java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
StreamablewriteTo in interface StreamablewriteTo in interface WriteablewriteTo in class SingleShardRequest<GetRequest>java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object