CosmosQueryRequestOptions Class
- java.
lang. Object - com.
azure. cosmos. models. CosmosQueryRequestOptions
- com.
public class CosmosQueryRequestOptions
Specifies the options associated with query methods (enumeration operations) in the Azure Cosmos DB database service.
Constructor Summary
Constructor | Description |
---|---|
CosmosQueryRequestOptions() |
Instantiates a new query request options. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Consistency |
getConsistencyLevel()
Gets the consistency level required for the request. |
Cosmos |
getCustomItemSerializer()
Gets the custom item serializer defined for this instance of request options |
Dedicated |
getDedicatedGatewayRequestOptions()
Gets the Dedicated Gateway Request Options |
Cosmos |
getDiagnosticsThresholds()
Gets the diagnostic thresholds used as an override for a specific operation. |
List<String> |
getExcludedRegions()
Gets the list of regions to exclude for the request/retries. |
Feed |
getFeedRange()
Gets the FeedRange |
Set<String> |
getKeywordIdentifiers()
Gets the custom ids. |
int |
getMaxBufferedItemCount()
Gets the maximum number of items that can be buffered client side during parallel query execution. |
int |
getMaxDegreeOfParallelism()
Gets the number of concurrent operations run client side during parallel query execution. |
Partition |
getPartitionKey()
Gets the partition key used to identify the current request's target partition. |
int |
getResponseContinuationTokenLimitInKb()
Gets the Response |
String |
getSessionToken()
Gets the session token for use with session consistency. |
Duration |
getThresholdForDiagnosticsOnTracer()
Gets the threshold |
String |
getThroughputControlGroupName()
Get throughput control group name. |
boolean |
isIndexMetricsEnabled()
Gets index |
boolean |
isQueryMetricsEnabled()
Gets the option to enable populate query metrics. |
Boolean |
isScanInQueryEnabled()
Gets the option to allow scan on the queries which couldn't be served as indexing was opted out on the requested paths. |
Cosmos |
setConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the consistency level required for the request. |
Cosmos |
setCosmosEndToEndOperationLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig cosmosEndToEndOperationLatencyPolicyConfig)
Sets the CosmosEndToEndOperationLatencyPolicyConfig to be used for the request. |
Cosmos |
setCustomItemSerializer(CosmosItemSerializer customItemSerializer)
Allows specifying a custom item serializer to be used for this operation. |
Cosmos |
setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions)
Sets the Dedicated Gateway Request Options |
Cosmos |
setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds)
Allows overriding the diagnostic thresholds for a specific operation. |
Cosmos |
setExcludedRegions(List<String> excludeRegions)
List of regions to be excluded for the request/retries. |
Cosmos |
setFeedRange(FeedRange feedRange)
Sets the FeedRange that we want to query |
Cosmos |
setIndexMetricsEnabled(boolean indexMetricsEnabled)
Sets index |
Cosmos |
setKeywordIdentifiers(Set<String> keywordIdentifiers)
Sets the custom ids. |
Cosmos |
setMaxBufferedItemCount(int maxBufferedItemCount)
Sets the maximum number of items that can be buffered client side during parallel query execution. |
Cosmos |
setMaxDegreeOfParallelism(int maxDegreeOfParallelism)
Sets the number of concurrent operations run client side during parallel query execution. |
Cosmos |
setPartitionKey(PartitionKey partitionkey)
Sets the partition key used to identify the current request's target partition. |
Cosmos |
setQueryMetricsEnabled(boolean queryMetricsEnabled)
Sets the option to enable/disable getting metrics relating to query execution on item query requests. |
Cosmos |
setQueryName(String queryName)
Sets the logical query name - this identifier is only used for metrics and logs to distinguish different queries in telemetry. |
Cosmos |
setResponseContinuationTokenLimitInKb(int limitInKb)
Sets the Response |
Cosmos |
setScanInQueryEnabled(Boolean scanInQueryEnabled)
Sets the option to allow scan on the queries which couldn't be served as indexing was opted out on the requested paths. |
Cosmos |
setSessionToken(String sessionToken)
Sets the session token for use with session consistency. |
Cosmos |
setThresholdForDiagnosticsOnTracer(Duration thresholdForDiagnosticsOnTracer)
Sets the threshold |
Cosmos |
setThroughputControlGroupName(String throughputControlGroupName)
Set the throughput control group name. |
Methods inherited from java.lang.Object
Constructor Details
CosmosQueryRequestOptions
public CosmosQueryRequestOptions()
Instantiates a new query request options.
Method Details
getConsistencyLevel
public ConsistencyLevel getConsistencyLevel()
Gets the consistency level required for the request.
Returns:
getCustomItemSerializer
public CosmosItemSerializer getCustomItemSerializer()
Gets the custom item serializer defined for this instance of request options
Returns:
getDedicatedGatewayRequestOptions
public DedicatedGatewayRequestOptions getDedicatedGatewayRequestOptions()
Gets the Dedicated Gateway Request Options
Returns:
getDiagnosticsThresholds
public CosmosDiagnosticsThresholds getDiagnosticsThresholds()
Gets the diagnostic thresholds used as an override for a specific operation. If no operation specific diagnostic threshold has been specified, this method will return null, although at runtime the default thresholds specified at the client-level will be used.
Returns:
getExcludedRegions
public List
Gets the list of regions to exclude for the request/retries. These regions are excluded from the preferred region list.
Returns:
getKeywordIdentifiers
public Set
Gets the custom ids.
Returns:
getMaxBufferedItemCount
public int getMaxBufferedItemCount()
Gets the maximum number of items that can be buffered client side during parallel query execution.
Returns:
getMaxDegreeOfParallelism
public int getMaxDegreeOfParallelism()
Gets the number of concurrent operations run client side during parallel query execution.
Returns:
getPartitionKey
public PartitionKey getPartitionKey()
Gets the partition key used to identify the current request's target partition.
Returns:
getResponseContinuationTokenLimitInKb
public int getResponseContinuationTokenLimitInKb()
Gets the ResponseContinuationTokenLimitInKb request option for item query requests in the Azure Cosmos DB service. If not already set returns 0.
ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. Valid values are >= 1.
Returns:
getSessionToken
public String getSessionToken()
Gets the session token for use with session consistency.
Returns:
getThresholdForDiagnosticsOnTracer
public Duration getThresholdForDiagnosticsOnTracer()
Gets the thresholdForDiagnosticsOnTracer, if latency on query operation is greater than this diagnostics will be send to open telemetry exporter as events in tracer span of end to end CRUD api. Default is 500 ms.
Returns:
getThroughputControlGroupName
public String getThroughputControlGroupName()
Get throughput control group name.
Returns:
isIndexMetricsEnabled
public boolean isIndexMetricsEnabled()
Gets indexMetricsEnabled, which is used to obtain the index metrics to understand how the query engine used existing indexes and could use potential new indexes. The results will be displayed in QueryMetrics. Please note that this options will incurs overhead, so it should be enabled when debuging slow queries.
Returns:
isQueryMetricsEnabled
public boolean isQueryMetricsEnabled()
Gets the option to enable populate query metrics. By default query metrics are enabled.
Returns:
isScanInQueryEnabled
public Boolean isScanInQueryEnabled()
Gets the option to allow scan on the queries which couldn't be served as indexing was opted out on the requested paths.
Returns:
setConsistencyLevel
public CosmosQueryRequestOptions setConsistencyLevel(ConsistencyLevel consistencyLevel)
Sets the consistency level required for the request. The effective consistency level can only be reduce for read/query requests. So when the Account's default consistency level is for example Session you can specify on a request-by-request level for individual requests that Eventual consistency is sufficient - which could reduce the latency and RU charges for this request but will not guarantee session consistency (read-your-own-write) anymore
Parameters:
Returns:
setCosmosEndToEndOperationLatencyPolicyConfig
public CosmosQueryRequestOptions setCosmosEndToEndOperationLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig cosmosEndToEndOperationLatencyPolicyConfig)
Sets the CosmosEndToEndOperationLatencyPolicyConfig to be used for the request. If the config is already set * on the client, then this will override the client level config for this request
Parameters:
Returns:
setCustomItemSerializer
public CosmosQueryRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer)
Allows specifying a custom item serializer to be used for this operation. If the serializer on the request options is null, the serializer on CosmosClientBuilder is used. If both serializers are null (the default), an internal Jackson ObjectMapper is ued for serialization/deserialization.
Parameters:
Returns:
setDedicatedGatewayRequestOptions
public CosmosQueryRequestOptions setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions)
Sets the Dedicated Gateway Request Options
Parameters:
Returns:
setDiagnosticsThresholds
public CosmosQueryRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds)
Allows overriding the diagnostic thresholds for a specific operation.
Parameters:
Returns:
setExcludedRegions
public CosmosQueryRequestOptions setExcludedRegions(List
List of regions to be excluded for the request/retries. Example "East US" or "East US, West US" These regions will be excluded from the preferred regions list
Parameters:
Returns:
setFeedRange
setIndexMetricsEnabled
public CosmosQueryRequestOptions setIndexMetricsEnabled(boolean indexMetricsEnabled)
Sets indexMetricsEnabled, which is used to obtain the index metrics to understand how the query engine used existing indexes and could use potential new indexes. The results will be displayed in QueryMetrics. Please note that this options will incurs overhead, so it should be enabled when debugging slow queries. By default the indexMetrics are disabled.
Parameters:
Returns:
setKeywordIdentifiers
public CosmosQueryRequestOptions setKeywordIdentifiers(Set
Sets the custom ids.
Parameters:
Returns:
setMaxBufferedItemCount
public CosmosQueryRequestOptions setMaxBufferedItemCount(int maxBufferedItemCount)
Sets the maximum number of items that can be buffered client side during parallel query execution.
Parameters:
Returns:
setMaxDegreeOfParallelism
public CosmosQueryRequestOptions setMaxDegreeOfParallelism(int maxDegreeOfParallelism)
Sets the number of concurrent operations run client side during parallel query execution.
Parameters:
Returns:
setPartitionKey
public CosmosQueryRequestOptions setPartitionKey(PartitionKey partitionkey)
Sets the partition key used to identify the current request's target partition.
Parameters:
Returns:
setQueryMetricsEnabled
public CosmosQueryRequestOptions setQueryMetricsEnabled(boolean queryMetricsEnabled)
Sets the option to enable/disable getting metrics relating to query execution on item query requests. By default query metrics are enabled.
Parameters:
Returns:
setQueryName
public CosmosQueryRequestOptions setQueryName(String queryName)
Sets the logical query name - this identifier is only used for metrics and logs to distinguish different queries in telemetry. Cardinality of unique values for queryName should be reasonably low - like significantly smaller than 100.
Parameters:
Returns:
setResponseContinuationTokenLimitInKb
public CosmosQueryRequestOptions setResponseContinuationTokenLimitInKb(int limitInKb)
Sets the ResponseContinuationTokenLimitInKb request option for item query requests in the Azure Cosmos DB service.
ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. Valid values are >= 1.
The continuation token contains both required and optional fields. The required fields are necessary for resuming the execution from where it was stooped. The optional fields may contain serialized index lookup work that was done but not yet utilized. This avoids redoing the work again in subsequent continuations and hence improve the query performance. Setting the maximum continuation size to 1KB, the Azure Cosmos DB service will only serialize required fields. Starting from 2KB, the Azure Cosmos DB service would serialize as much as it could fit till it reaches the maximum specified size.
Parameters:
Returns:
setScanInQueryEnabled
public CosmosQueryRequestOptions setScanInQueryEnabled(Boolean scanInQueryEnabled)
Sets the option to allow scan on the queries which couldn't be served as indexing was opted out on the requested paths.
Parameters:
Returns:
setSessionToken
public CosmosQueryRequestOptions setSessionToken(String sessionToken)
Sets the session token for use with session consistency.
Parameters:
Returns:
setThresholdForDiagnosticsOnTracer
public CosmosQueryRequestOptions setThresholdForDiagnosticsOnTracer(Duration thresholdForDiagnosticsOnTracer)
Sets the thresholdForDiagnosticsOnTracer, if latency on query operation is greater than this diagnostics will be send to open telemetry exporter as events in tracer span of end to end CRUD api. Default is 500 ms
Parameters:
Returns:
setThroughputControlGroupName
public CosmosQueryRequestOptions setThroughputControlGroupName(String throughputControlGroupName)
Set the throughput control group name.
Parameters:
Returns: