DSE advanced workloads in Cassandra drivers
|
Advanced workloads are supported on Tier E Astra Managed Clusters databases only. |
Tier E Astra Managed Clusters databases can use the built-in query methods in Apache Cassandra® as well as DSE Search advanced workloads:
-
DSE Core (Cassandra): Transactional workloads that are typically handled through standard Cassandra Query Language (CQL) queries.
-
DSE Search: Filtering workloads that are typically handled through Apache Lucene™ queries.
You can use Astra-compatible drivers to run DSE Core and Search queries within the same application. When developing an application, each workload type requires different techniques to effectively leverage the use case covered by the workload. This page provides guidance on working with DSE advanced workloads through Astra-compatible drivers.
Use datacenter-aware load balancing policies
DSE advanced workloads queries must be routed to datacenters where you have deployed Astra nodes that support the required workload types.
To ensure that your driver directs queries to compatible datacenters, use a datacenter-aware load balancing policy directed to the local datacenter where you have enabled the desired workload type. To set a Tier E Astra Managed Clusters database as the local datacenter, you must provide the database’s Secure Connect Bundle (SCB) in the driver configuration.
There are two ways you can configure your driver to use a datacenter-aware load balancing policy:
- Use execution profiles
-
If your driver supports execution profiles, you can define separate profiles for each workload type used by your application. Each profile can have a unique load balancing policy that directs the queries to a compatible datacenter.
For example, if you have two datacenters, but only one supports DSE Search, you can define a
SearchExecutionProfileto direct DSE Search queries to the datacenter that supports DSE Search. When you configure theSearchExecutionProfile, use theDCAwareload balancing policy, and provide the SCB for the database where you have enabled DSE Search. Then, use this profile for all execution methods that run DSE Search queries to ensure that the queries are directed to the compatible datacenter. - Use one driver instance for each workload type
-
For drivers that don’t support execution profiles, you can use separate driver instances for the different workloads used in your application. This is similar to the execution profile mechanics except that the local datacenter is set in the load balancing policy when creating the driver instance.
For example, you could create a
SearchSessionwhere you provide the SCB for your DSE Search-enabled database, which is then used as the local datacenter in the load balancing policy. Then, use thisSearchSessionin the application for all queries that use DSE Search indexes.
DSE Core
DSE Core (transactional) workloads are standard CQL queries. This workload type is supported in Astra-compatible drivers through built-in synchronous and asynchronous query execution. For information about query execution with Astra-compatible drivers, see Get started with queries in Cassandra drivers and Asynchronous query execution with Cassandra drivers.
DSE Search
With DSE Search, your applications can query data using general queries, customized search indexes, and other specialized search techniques, such as full-text search, faceted search, spatial and temporal filtering, and hit prioritization.
Prepare to use DSE Search
-
Deploy a Tier E Astra Managed Clusters database, if you don’t already have one.
-
Configure search indexes for all columns that will be accessed with DSE Search queries.
DataStax recommends that you plan your search indexes in advance as part of your data modeling practices because adding search indexes can be resource intensive and impact cluster performance.
For more information, see the following:
-
Ensure that your driver’s load balancing policy directs DSE Search queries to the datacenter where your DSE Search-enabled nodes are located. For more information, see Use datacenter-aware load balancing policies.
Run DSE Search queries
To run DSE Search queries, you can use the solr_query search index syntax in the WHERE clause, or you can use standard CQL semantics.
Because DSE Search queries are integrated with standard CQL, DSE Search workloads are supported in Astra-compatible drivers through their built-in query execution functionality.
For more information on executing DSE Search queries, see the following:
- Query execution with Astra-compatible drivers
-
See Get started with queries in Cassandra drivers and Asynchronous query execution with Cassandra drivers.
- Geospatial
-
For location-based search with DSE Search, use the geospatial data types:
Point,LineString, andPolygon. For more information, see Geospatial queries for Point and LineString and information about geospatial types in your driver’s documentation. - Date range
-
DSE Search supports date and time filters, including point-in-time and open bound date ranges. To apply date and time filters, use the CQL
DateRangeType. - Other search techniques
-
For information about other DSE Search query techniques, see the DSE Search documentation and information about DSE Search features in your driver’s documentation.
- Result paging
-
Result paging for DSE Search queries integrates the drivers' built-in result paging with Apache Solr™ cursor-based paging. To enable paging for DSE Search queries, use
solr_queryparameters to dynamically set paging in your application.