public class AnalyticsOptions extends CommonOptions<AnalyticsOptions>
This object is NOT thread safe and must be constructed on a single thread and then passed to the
Cluster.analyticsQuery(String, AnalyticsOptions)
method.
Modifier and Type | Class and Description |
---|---|
class |
AnalyticsOptions.Built |
CommonOptions.BuiltCommonOptions
Modifier and Type | Method and Description |
---|---|
static AnalyticsOptions |
analyticsOptions()
Creates new
AnalyticsOptions with all default params set. |
AnalyticsOptions.Built |
build() |
AnalyticsOptions |
clientContextId(String clientContextId)
Supports providing a custom client context ID for this query.
|
AnalyticsOptions |
parameters(JsonArray positional)
Sets positional parameters for this query.
|
AnalyticsOptions |
parameters(JsonObject named)
Sets named parameters for this query.
|
AnalyticsOptions |
priority(boolean priority)
Allows assigning a different server-side priority to the current query.
|
AnalyticsOptions |
raw(String key,
Object value)
Allows providing custom JSON key/value pairs for advanced usage.
|
AnalyticsOptions |
readonly(boolean readonly)
Allows explicitly marking a query as being readonly and not mutating and documents on the server side.
|
AnalyticsOptions |
scanConsistency(AnalyticsScanConsistency scanConsistency)
Customizes the consistency guarantees for this query.
|
AnalyticsOptions |
serializer(JsonSerializer serializer)
Provides a custom
JsonSerializer to be used for decoding the rows as they return from the server. |
clientContext, parentSpan, retryStrategy, self, timeout
public static AnalyticsOptions analyticsOptions()
AnalyticsOptions
with all default params set.AnalyticsOptions
with its default values.public AnalyticsOptions priority(boolean priority)
priority
- if this request should have higher priority than other requests on the server.AnalyticsOptions
for chaining purposes.public AnalyticsOptions clientContextId(String clientContextId)
If no client context ID is provided by the user, a UUID is generated and sent automatically so by default it is always possible to identify a query when debugging. If you do not want to send one, pass either null or an empty string to this method.
clientContextId
- the client context ID - if null or empty it will not be sent.AnalyticsOptions
for chaining purposes.public AnalyticsOptions readonly(boolean readonly)
In addition to providing some security in that you are not accidentally modifying data, setting this flag to true also helps the client to more proactively retry and re-dispatch a query since then it can be sure it is idempotent. As a result, if your query is readonly then it is a good idea to set this flag.
Note that this property is only supported when using Couchbase Server 6.5 or later.
readonly
- true if readonly should be set, false is the default and will use the server side default.AnalyticsOptions
for chaining purposes.public AnalyticsOptions serializer(JsonSerializer serializer)
JsonSerializer
to be used for decoding the rows as they return from the server.
If no serializer is provided, the default one from the ClusterEnvironment
will be used (which is
sufficient for most tasks at hand).
serializer
- a custom serializer for this request.AnalyticsOptions
for chaining purposes.public AnalyticsOptions scanConsistency(AnalyticsScanConsistency scanConsistency)
Tuning the scan consistency allows to trade data "freshness" for latency and vice versa. By default
AnalyticsScanConsistency.NOT_BOUNDED
is used, which means that the server returns the data it has in the
index right away. This is fast, but might not include the most recent mutations. If you want to include all
the mutations up to the point of the query, use AnalyticsScanConsistency.REQUEST_PLUS
.
scanConsistency
- the index scan consistency to be used for this query.AnalyticsOptions
for chaining purposes.public AnalyticsOptions parameters(JsonObject named)
Note that named and positional parameters cannot be used at the same time. If one is set, the other one is "nulled" out and not being sent to the server.
named
- JsonObject
the named parameters.AnalyticsOptions
for chaining purposes.public AnalyticsOptions parameters(JsonArray positional)
Note that named and positional parameters cannot be used at the same time. If one is set, the other one is "nulled" out and not being sent to the server.
positional
- JsonArray
the positional parameters.AnalyticsOptions
for chaining purposes.public AnalyticsOptions raw(String key, Object value)
If available, it is recommended to use the methods on this object to customize the query. This method should only be used if no such setter can be found (i.e. if an undocumented property should be set or you are using an older client and a new server-configuration property has been added to the cluster).
Note that the value will be passed through a JSON encoder, so do not provide already encoded JSON as the value. If
you want to pass objects or arrays, you can use JsonObject
and JsonArray
respectively.
key
- the parameter name (key of the JSON property) or empty.value
- the parameter value (value of the JSON property).AnalyticsOptions
for chaining purposes.@Stability.Internal public AnalyticsOptions.Built build()
Copyright © 2021 Couchbase, Inc.. All rights reserved.