Package org.elasticsearch.action.get
Class GetRequestBuilder
java.lang.Object
org.elasticsearch.action.ActionRequestBuilder<Request,Response>
org.elasticsearch.action.support.single.shard.SingleShardOperationRequestBuilder<GetRequest,GetResponse,GetRequestBuilder>
org.elasticsearch.action.get.GetRequestBuilder
public class GetRequestBuilder
extends SingleShardOperationRequestBuilder<GetRequest,GetResponse,GetRequestBuilder>
A get document action request builder.
-
Field Summary
Fields inherited from class org.elasticsearch.action.ActionRequestBuilder
action, client, request
-
Constructor Summary
ConstructorDescriptionGetRequestBuilder(ElasticsearchClient client, GetAction action)
GetRequestBuilder(ElasticsearchClient client, GetAction action, String index)
-
Method Summary
Modifier and TypeMethodDescriptionsetFetchSource(boolean fetch)
Indicates whether the response should contain the stored _source.setFetchSource(String[] includes, String[] excludes)
Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.setFetchSource(String include, String exclude)
Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.Sets the id of the document to fetch.setPreference(String preference)
Sets the preference to execute the search.setRealtime(boolean realtime)
setRefresh(boolean refresh)
Should a refresh be executed before this get operation causing the operation to return the latest value.setRouting(String routing)
Controls the shard routing of the request.setStoredFields(String... fields)
Explicitly specify the fields that will be returned.Sets the type of the document to fetch.setVersion(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.setVersionType(VersionType versionType)
Sets the versioning type.Methods inherited from class org.elasticsearch.action.support.single.shard.SingleShardOperationRequestBuilder
setIndex
-
Constructor Details
-
GetRequestBuilder
-
GetRequestBuilder
-
-
Method Details
-
setType
Sets the type of the document to fetch. If set tonull
, will use just the id to fetch the first document matching it. -
setId
Sets the id of the document to fetch. -
setRouting
Controls the shard routing of the request. Using this value to hash the shard and not the id. -
setPreference
Sets the preference to execute the search. Defaults to randomize across shards. Can be set to_local
to prefer local shards or a custom value, which guarantees that the same order will be used across different requests. -
setStoredFields
Explicitly specify the fields that will be returned. By default, the_source
field will be returned. -
setFetchSource
Indicates whether the response should contain the stored _source.- Returns:
- this for chaining
-
setFetchSource
Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.- Parameters:
include
- An optional include (optionally wildcarded) pattern to filter the returned _sourceexclude
- An optional exclude (optionally wildcarded) pattern to filter the returned _source
-
setFetchSource
Indicate that _source should be returned, with an "include" and/or "exclude" set which can include simple wildcard elements.- Parameters:
includes
- An optional list of include (optionally wildcarded) pattern to filter the returned _sourceexcludes
- An optional list of exclude (optionally wildcarded) pattern to filter the returned _source
-
setRefresh
Should a refresh be executed before this get operation causing the operation to return the latest value. Note, heavy get should not set this totrue
. Defaults tofalse
. -
setRealtime
-
setVersion
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. -
setVersionType
Sets the versioning type. Defaults toVersionType.INTERNAL
.
-