Class 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.
- Since:
- 3.0.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.couchbase.client.java.CommonOptions
CommonOptions.BuiltCommonOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic AnalyticsOptionsCreates newAnalyticsOptionswith all default params set.build()clientContextId(String clientContextId) Supports providing a custom client context ID for this query.parameters(JsonArray positional) Sets positional parameters for this query.parameters(JsonObject named) Sets named parameters for this query.priority(boolean priority) Allows assigning a different server-side priority to the current query.Allows providing custom JSON key/value pairs for advanced usage.readonly(boolean readonly) Allows explicitly marking a query as being readonly and not mutating and documents on the server side.scanConsistency(AnalyticsScanConsistency scanConsistency) Customizes the consistency guarantees for this query.Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.serializer(JsonSerializer serializer) Provides a customJsonSerializerto be used for decoding the rows as they return from the server.Methods inherited from class com.couchbase.client.java.CommonOptions
clientContext, parentSpan, retryStrategy, self, timeout
-
Method Details
-
analyticsOptions
Creates newAnalyticsOptionswith all default params set.- Returns:
- constructed
AnalyticsOptionswith its default values.
-
priority
Allows assigning a different server-side priority to the current query.- Parameters:
priority- if this request should have higher priority than other requests on the server.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
clientContextId
Supports providing a custom client context ID for this query.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.
- Parameters:
clientContextId- the client context ID - if null or empty it will not be sent.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
readonly
Allows explicitly marking a query as being readonly and not mutating and documents on the server side.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.
- Parameters:
readonly- true if readonly should be set, false is the default and will use the server side default.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
serializer
Provides a customJsonSerializerto be used for decoding the rows as they return from the server.If no serializer is provided, the default one from the
ClusterEnvironmentwill be used (which is sufficient for most tasks at hand).- Parameters:
serializer- a custom serializer for this request.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
scanConsistency
Customizes the consistency guarantees for this query.Tuning the scan consistency allows to trade data "freshness" for latency and vice versa. By default
AnalyticsScanConsistency.NOT_BOUNDEDis 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, useAnalyticsScanConsistency.REQUEST_PLUS.- Parameters:
scanConsistency- the index scan consistency to be used for this query.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
scanWait
Allows customizing how long the query engine is willing to wait until the index catches up to whatever scan consistency is asked for in this query.Note that if
AnalyticsScanConsistency.NOT_BOUNDEDis used (which is the default), this method doesn't do anything at all. If no value is provided to this method, the server default is used.- Parameters:
wait- the maximum duration the analytics engine should wait before failing.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
parameters
Sets named parameters for this query.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.
- Parameters:
named-JsonObjectthe named parameters.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
parameters
Sets positional parameters for this query.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.
- Parameters:
positional-JsonArraythe positional parameters.- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
raw
Allows providing custom JSON key/value pairs for advanced usage.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
JsonObjectandJsonArrayrespectively.- Parameters:
key- the parameter name (key of the JSON property) or empty.value- the parameter value (value of the JSON property).- Returns:
- the same
AnalyticsOptionsfor chaining purposes.
-
build
-