public class GetRequest extends SingleShardRequest<GetRequest> implements RealtimeRequest
Requests.getRequest(String)
.
The operation requires the SingleShardRequest.index()
, type(String)
and id(String)
to be set.
TransportRequest.Empty
IndicesRequest.Replaceable
index, INDICES_OPTIONS
headers
Constructor and Description |
---|
GetRequest() |
GetRequest(ActionRequest request,
String index)
Constructs a new get request starting from the provided request, meaning that it will
inherit its headers and context, and against the specified index.
|
GetRequest(GetRequest getRequest,
ActionRequest originalRequest)
Copy constructor that creates a new get request that is a copy of the one provided as an argument.
|
GetRequest(String index)
Constructs a new get request against the specified index.
|
GetRequest(String index,
String type,
String id)
Constructs a new get request against the specified index with the type and id.
|
Modifier and Type | Method and Description |
---|---|
FetchSourceContext |
fetchSourceContext() |
GetRequest |
fetchSourceContext(FetchSourceContext context)
Allows setting the
FetchSourceContext for this request, controlling if and how _source should be returned. |
String[] |
fields()
Explicitly specify the fields that will be returned.
|
GetRequest |
fields(String... fields)
Explicitly specify the fields that will be returned.
|
String |
id() |
GetRequest |
id(String id)
Sets the id of the document to fetch.
|
boolean |
ignoreErrorsOnGeneratedFields() |
GetRequest |
ignoreErrorsOnGeneratedFields(boolean ignoreErrorsOnGeneratedFields) |
GetRequest |
parent(String parent)
Sets the parent id of this document.
|
String |
preference() |
GetRequest |
preference(String preference)
Sets the preference to execute the search.
|
void |
readFrom(StreamInput in) |
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.
|
String |
routing() |
GetRequest |
routing(String routing)
Controls the shard routing of the request.
|
String |
toString() |
String |
type() |
GetRequest |
type(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) |
index, index, indices, indicesOptions, operationThreaded, operationThreaded, validateNonNullIndex
createTask, getDescription
remoteAddress, remoteAddress
contextSize, copyContextAndHeadersFrom, copyContextFrom, copyHeadersFrom, getContext, getFromContext, getFromContext, getHeader, getHeaders, hasHeader, hasInContext, isContextEmpty, putAllInContext, putHeader, putInContext
public GetRequest()
public GetRequest(GetRequest getRequest, ActionRequest originalRequest)
public GetRequest(String index)
type(String)
and id(String)
must be set.public GetRequest(ActionRequest request, String index)
public ActionRequestValidationException validate()
validate
in class ActionRequest<GetRequest>
public GetRequest type(@Nullable String type)
public GetRequest id(String id)
public GetRequest parent(String parent)
public GetRequest routing(String routing)
public GetRequest preference(String preference)
public String type()
public String id()
public String routing()
public String preference()
public GetRequest fetchSourceContext(FetchSourceContext context)
FetchSourceContext
for this request, controlling if and how _source should be returned.public FetchSourceContext fetchSourceContext()
public GetRequest fields(String... fields)
public String[] fields()
public GetRequest refresh(boolean refresh)
public boolean refresh()
public boolean realtime()
public GetRequest realtime(Boolean realtime)
realtime
in interface RealtimeRequest
realtime
- Controls whether this request should be realtime by reading from the translog. If null
is specified then whether the operation will be realtime depends on the api of the concrete request
subclass.public long version()
public GetRequest version(long version)
public GetRequest versionType(VersionType versionType)
VersionType.INTERNAL
.public GetRequest ignoreErrorsOnGeneratedFields(boolean ignoreErrorsOnGeneratedFields)
public VersionType versionType()
public boolean ignoreErrorsOnGeneratedFields()
public void readFrom(StreamInput in) throws IOException
readFrom
in interface Streamable
readFrom
in class SingleShardRequest<GetRequest>
IOException
public void writeTo(StreamOutput out) throws IOException
writeTo
in interface Streamable
writeTo
in class SingleShardRequest<GetRequest>
IOException
Copyright © 2009–2016. All rights reserved.