Package com.couchbase.client.java.query
Class QueryOptions
- java.lang.Object
-
- com.couchbase.client.java.CommonOptions<QueryOptions>
-
- com.couchbase.client.java.query.QueryOptions
-
public class QueryOptions extends CommonOptions<QueryOptions>
N1QL query request options.- Since:
- 3.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
QueryOptions.Built
-
Nested classes/interfaces inherited from class com.couchbase.client.java.CommonOptions
CommonOptions.BuiltCommonOptions
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryOptions
adhoc(boolean adhoc)
If set to false, enables transparent prepared statement support.QueryOptions.Built
build()
QueryOptions
clientContextId(String clientContextId)
Adds a client context ID to the request, that will be sent back in the response, allowing clients to meaningfully trace requests/responses when many are exchanged.QueryOptions
consistentWith(MutationState mutationState)
Sets theMutationToken
s this query should be consistent with.QueryOptions
maxParallelism(int maxParallelism)
Allows to override the default maximum parallelism for the query execution on the server side.QueryOptions
metrics(boolean metrics)
If set to true (false being the default), the metrics object will be returned from N1QL and as a result provide insight into timings.QueryOptions
parameters(JsonArray positional)
Positional parameters if the query is parameterized with position numbersQueryOptions
parameters(JsonObject named)
Named parameters if the query is parameterized with custom namesQueryOptions
pipelineBatch(int pipelineBatch)
Advanced: Controls the number of items execution operators can batch for Fetch from the KV.QueryOptions
pipelineCap(int pipelineCap)
Advanced: Maximum number of items each execution operator can buffer between various operators.QueryOptions
profile(QueryProfile profile)
Set the profiling information level for query executionstatic QueryOptions
queryOptions()
QueryOptions
raw(String param, Object value)
Raw parameters for the queryQueryOptions
readonly(boolean readonly)
If set to true, it will signal the query engine on the server that only non-data modifying requests are allowed.QueryOptions
scanCap(int scanCap)
Advanced: Maximum buffered channel size between the indexer client and the query service for index scans.QueryOptions
scanConsistency(QueryScanConsistency scanConsistency)
Scan consistency for the queryQueryOptions
scanWait(Duration wait)
If thescan consistency
has been chosen, does nothing.QueryOptions
serializer(JsonSerializer serializer)
-
Methods inherited from class com.couchbase.client.java.CommonOptions
clientContext, retryStrategy, self, timeout
-
-
-
-
Method Detail
-
queryOptions
public static QueryOptions queryOptions()
-
raw
public QueryOptions raw(String param, Object value)
Raw parameters for the query- Parameters:
param
- the parameter namevalue
- the parameter value- Returns:
QueryOptions
for further chaining
-
adhoc
public QueryOptions adhoc(boolean adhoc)
If set to false, enables transparent prepared statement support.- Parameters:
adhoc
- if this is an ad-hoc query.- Returns:
QueryOptions
for further chaining.
-
scanConsistency
public QueryOptions scanConsistency(QueryScanConsistency scanConsistency)
Scan consistency for the query- Parameters:
scanConsistency
- the index scan consistency to be used- Returns:
QueryOptions
for further chaining
-
serializer
public QueryOptions serializer(JsonSerializer serializer)
-
profile
public QueryOptions profile(QueryProfile profile)
Set the profiling information level for query execution- Parameters:
profile
- the query profile level to be used- Returns:
QueryOptions
for further chaining
-
clientContextId
public QueryOptions clientContextId(String clientContextId)
Adds a client context ID to the request, that will be sent back in the response, allowing clients to meaningfully trace requests/responses when many are exchanged.- Parameters:
clientContextId
- the client context ID (null to send none)- Returns:
- this
QueryOptions
for chaining.
-
metrics
public QueryOptions metrics(boolean metrics)
If set to true (false being the default), the metrics object will be returned from N1QL and as a result provide insight into timings.- Parameters:
metrics
- true if enabled, false otherwise (true = default).- Returns:
- this
QueryOptions
for chaining.
-
scanWait
public QueryOptions scanWait(Duration wait)
If thescan consistency
has been chosen, does nothing. Otherwise, sets the maximum time the client is willing to wait for an index to catch up to the vector timestamp in the request.- Parameters:
wait
- the duration.- Returns:
- this
QueryOptions
for chaining.
-
maxParallelism
public QueryOptions maxParallelism(int maxParallelism)
Allows to override the default maximum parallelism for the query execution on the server side.- Parameters:
maxParallelism
- the maximum parallelism for this query, 0 or negative values disable it.- Returns:
- this
QueryOptions
for chaining.
-
readonly
public QueryOptions readonly(boolean readonly)
If set to true, it will signal the query engine on the server that only non-data modifying requests are allowed. Note that this rule is enforced on the server and not the SDK side. Controls whether a query can change a resulting record set. If readonly is true, then the following statements are not allowed: - CREATE INDEX - DROP INDEX - INSERT - MERGE - UPDATE - UPSERT - DELETE- Parameters:
readonly
- true if readonly should be forced, false is the default and will use the server side default.- Returns:
- this
QueryOptions
for chaining.
-
scanCap
public QueryOptions scanCap(int scanCap)
Advanced: Maximum buffered channel size between the indexer client and the query service for index scans. This parameter controls when to use scan backfill. Use 0 or a negative number to disable.- Parameters:
scanCap
- the scan_cap param, use 0 or negative number to disable.- Returns:
- this
QueryOptions
for chaining.
-
pipelineBatch
public QueryOptions pipelineBatch(int pipelineBatch)
Advanced: Controls the number of items execution operators can batch for Fetch from the KV.- Parameters:
pipelineBatch
- the pipeline_batch param.- Returns:
- this
QueryOptions
for chaining.
-
pipelineCap
public QueryOptions pipelineCap(int pipelineCap)
Advanced: Maximum number of items each execution operator can buffer between various operators.- Parameters:
pipelineCap
- the pipeline_cap param.- Returns:
- this
QueryOptions
for chaining.
-
parameters
public QueryOptions parameters(JsonObject named)
Named parameters if the query is parameterized with custom names- Parameters:
named
-JsonObject
with name as key- Returns:
- this
QueryOptions
for chaining.
-
parameters
public QueryOptions parameters(JsonArray positional)
Positional parameters if the query is parameterized with position numbers- Parameters:
positional
-JsonArray
in the same order as positions- Returns:
- this
QueryOptions
for chaining.
-
consistentWith
public QueryOptions consistentWith(MutationState mutationState)
Sets theMutationToken
s this query should be consistent with. These tokens are returned from mutations.- Parameters:
mutationState
- the mutation tokens- Returns:
- this
QueryOptions
for chaining.
-
build
@Internal public QueryOptions.Built build()
-
-