ScyllaDB University LIVE, FREE Virtual Training Event | March 21
Register for Free
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Manual Features Pattern Search in ScyllaDB
For AI agents: a documentation index is available at https://docs.scylladb.com/manual/master/llms.txt. A Markdown version of this page is at https://docs.scylladb.com/manual/master/features/pattern-search.md.

Caution

You're viewing documentation for an unstable version of ScyllaDB Manual. Switch to the latest stable version.

Pattern Search in ScyllaDB¶

What Is Pattern Search¶

Pattern Search finds the rows whose text column matches a LIKE pattern, such as '%abc%', 'abc%' or 'a%b', but served by an index rather than by a scan of the table. The index node does not match approximately: a value matches when the whole of it matches the pattern. The pattern has the same syntax as in a filtered LIKE, with the same %, _ and \ rules, but the query does not behave like a filtered one in other respects; see Indexed vs. Filtered LIKE.

It suits values that are searched by any part of them rather than by whole words, such as product codes, identifiers and tags. For example, with the table below:

code
------------
AB-1024-XL
AB-2048-S
ab-4096-M
XAB-1024
CD-1024-AB
  • code LIKE 'AB-%' returns AB-1024-XL and AB-2048-S, and also ab-4096-M on an index created with 'case_sensitive': 'false'. It does not return XAB-1024 or CD-1024-AB, which contain AB but do not start with AB-.

  • code LIKE '%024%' returns AB-1024-XL, XAB-1024 and CD-1024-AB. It matches inside 1024, which a word-based search would not find.

  • code LIKE '%-_' returns AB-2048-S and ab-4096-M, the codes that end with a one-character suffix.

A row either matches the pattern or it does not, and no row is ranked above another: CD-1024-AB, with AB at its end, is as much a result of code LIKE '%AB%' as AB-1024-XL. When more rows match than the LIMIT, which of them are returned is not specified. A query can also return fewer rows than its LIMIT, even when more rows match, if a row was deleted after the index found it.

Pattern Search does not tokenize, stem or rank. For word-based search ranked by relevance, use Full-Text Search.

Creating a Pattern Index¶

A pattern_index on a column serves the LIKE restrictions on that column. Such a query does not need ALLOW FILTERING; if it is given, it is ignored and the index is still used. To create the index:

CREATE CUSTOM INDEX ON ks.parts (code) USING 'pattern_index';

or, to match regardless of letter case:

CREATE CUSTOM INDEX ON ks.parts (code) USING 'pattern_index'
    WITH OPTIONS = {'case_sensitive': 'false'};

For the option and its default, see Pattern Index.

Warning

Creating a pattern index changes the meaning of every LIKE on its column, for every application that queries the column. Once the index exists, a LIKE on the column is served by the index, even with ALLOW FILTERING:

  • Queries that worked by filtering start failing. The LIKE must be the only restriction in the WHERE clause, and the query needs a LIMIT of at most 1000, so for example a LIKE together with a restriction on the partition key, or a LIKE without a LIMIT, is rejected.

  • Queries that still succeed can return different rows, without any error. The index is eventually consistent, so a recent write may be missed, and the rows are neither paged nor ordered. With 'case_sensitive': 'false', matching ignores letter case, so a LIKE returns rows that a filtered LIKE does not.

  • When the index node is unavailable, every LIKE on the column fails.

CREATE INDEX returns a warning that summarizes these changes. Dropping the index restores filtered LIKE (see Dropping a Pattern Index). For all the differences, see Indexed vs. Filtered LIKE.

Requirements:

  • The indexed column must be of type text, varchar, or ascii.

  • The indexed column must be a regular column. Primary-key and static columns cannot be indexed.

  • The table must use tablets (not vnodes).

  • CDC must be enabled on the table with a TTL of at least 86400 seconds (24 hours) and either delta = 'full' or postimage enabled, because the index is updated from the CDC log. CDC is enabled automatically when creating a pattern index, so you do not need to configure it manually.

Cell-level TTL, set with the standard USING TTL syntax on INSERT or UPDATE, makes the value unreadable at its expiration deadline but does not generate a CDC event, so the pattern index is not updated and keeps a stale entry for that value. A LIKE query can then still return the row, with the expired value read as null. If the index must reflect expiration, use the Per-row TTL feature instead.

Querying with LIKE¶

On a column with a pattern index, LIKE queries look like this:

SELECT id, code FROM ks.parts
    WHERE code LIKE '%024%'
    LIMIT 10;

SELECT id, code FROM ks.parts
    WHERE code LIKE 'AB-%'
    LIMIT 10;

SELECT id, code FROM ks.parts
    WHERE code LIKE ?
    LIMIT 10;

Creating the index is a deliberate choice to serve every LIKE on the column from the index, even with ALLOW FILTERING. The full rules are in Indexed LIKE queries.

Indexed vs. Filtered LIKE¶

Without a pattern index, LIKE is a filter: ScyllaDB reads the rows and checks each value against the pattern, as described in LIKE Operator. On a column with a pattern index, the same LIKE is served by the index instead, and the query differs from a filtered one as follows:

Filtered LIKE

Indexed LIKE

Where it works

Every deployment, on any text, varchar or ascii column.

ScyllaDB Cloud, on a regular column with a pattern_index. Every LIKE on that column is served by the index.

Matching

Always case-sensitive.

Case-sensitive, unless the index was created with 'case_sensitive': 'false': then letter case is ignored.

Patterns

Any pattern.

The same syntax. Which patterns are supported depends on the index node.

ALLOW FILTERING

Required.

Not needed. If given, it is ignored and the index is still used.

LIMIT

Optional, any value.

Required, at most 1000.

Other restrictions and clauses

Allowed, as in any query with ALLOW FILTERING.

None: the LIKE must be the only WHERE restriction, and ORDER BY, GROUP BY, PER PARTITION LIMIT and aggregation are rejected.

Paging

Paged like any other query.

Not paged: the whole result is returned in one page, with a warning when the page size is smaller than LIMIT.

Order

The order of a scan: by token, then by clustering key.

Not specified. When more rows match than the LIMIT, which of them are returned is not specified either.

Consistency

The rows are read, and matched, at the query’s consistency level.

Eventually consistent, and the rows are not checked against the pattern again: shortly after a write, a query may miss a new value, or return a row whose current value no longer matches the pattern.

Failure

Fails as any read does.

Also fails when the index node is unavailable or does not support the pattern.

Dropping a Pattern Index¶

Dropping the index restores filtered LIKE on its column:

DROP INDEX ks.parts_code_idx;

From then on, a LIKE on the column is a filter again: it requires ALLOW FILTERING, matches case-sensitively, and follows the rules of LIKE Operator. Dropping the index is the way back when the indexed LIKE does not suit an application that queries the column.

Was this page helpful?

PREVIOUS
Full-Text Search in ScyllaDB
NEXT
ScyllaDB Architecture
  • Create an issue
  • Edit this page

On this page

  • Pattern Search in ScyllaDB
    • What Is Pattern Search
    • Creating a Pattern Index
    • Querying with LIKE
      • Indexed vs. Filtered LIKE
    • Dropping a Pattern Index
ScyllaDB Manual
Search Ask AI
  • master
    • master
    • 2026.3
    • 2026.2
    • 2026.1
    • 2025.4
    • 2025.3
    • 2025.2
    • 2025.1
  • Getting Started
    • Install ScyllaDB 2026.3
      • Launch ScyllaDB 2026.3 on AWS
      • Launch ScyllaDB 2026.3 on GCP
      • Launch ScyllaDB 2026.3 on Azure
      • Launch ScyllaDB 2026.3 on Oracle Cloud Infrastructure (OCI)
      • ScyllaDB Web Installer for Linux
      • Install ScyllaDB 2026.3 Linux Packages
      • Run ScyllaDB in Docker
      • Install ScyllaDB Without root Privileges
      • Air-gapped Server Installation
      • ScyllaDB Developer Mode
    • Configure ScyllaDB
    • ScyllaDB Configuration Reference
    • ScyllaDB Requirements
      • System Requirements
      • OS Support
      • Cloud Instance Recommendations
      • ScyllaDB in a Shared Environment
    • Migrate to ScyllaDB
      • Migration Process from Cassandra to ScyllaDB
      • ScyllaDB and Apache Cassandra Compatibility
      • Migration Tools Overview
    • Integration Solutions
      • Integrate ScyllaDB with Spark
      • Integrate ScyllaDB with KairosDB
      • Integrate ScyllaDB with Presto
      • Integrate ScyllaDB with Elasticsearch
      • Integrate ScyllaDB with Kubernetes
      • Integrate ScyllaDB with the JanusGraph Graph Data System
      • Integrate ScyllaDB with DataDog
      • Integrate ScyllaDB with Kafka
      • Integrate ScyllaDB with IOTA Chronicle
      • Integrate ScyllaDB with Spring
      • Shard-Aware Kafka Connector for ScyllaDB
      • Install ScyllaDB with Ansible
      • Integrate ScyllaDB with Databricks
      • Integrate ScyllaDB with Jaeger Server
      • Integrate ScyllaDB with MindsDB
  • ScyllaDB for Administrators
    • Administration Guide
    • Procedures
      • Cluster Management
      • Backup & Restore
      • Change Configuration
      • Maintenance
      • Best Practices
      • Benchmarking ScyllaDB
      • Migrate from Cassandra to ScyllaDB
    • Security
      • ScyllaDB Security Checklist
      • Enable Authentication
      • Enable and Disable Authentication Without Downtime
      • Creating a Superuser
      • Generate a cqlshrc File
      • Reset Authenticator Password
      • Enable Authorization
      • Grant Authorization CQL Reference
      • Certificate-based Authentication
      • Certificate or Password Authentication
      • Role Based Access Control (RBAC)
      • ScyllaDB Auditing Guide
      • Encryption: Data in Transit Client to Node
      • Encryption: Data in Transit Node to Node
      • Generating a self-signed Certificate Chain Using openssl
      • Configure SaslauthdAuthenticator
      • Encryption at Rest
      • LDAP Authentication
      • LDAP Authorization (Role Management)
      • Software Bill Of Materials (SBOM)
    • Admin Tools
      • Nodetool Reference
      • CQLSh
      • Admin REST API
      • Tracing
      • ScyllaDB SStable
      • ScyllaDB SStable Script API
      • ScyllaDB Types
      • SSTableLoader
      • cassandra-stress
      • ScyllaDB Logs
      • Seastar Perftune
      • Virtual Tables
      • Reading mutation fragments
      • Maintenance socket
      • Maintenance mode
      • Task manager
      • Compression Advisor
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
    • ScyllaDB Manager
    • Upgrade Procedures
      • Upgrade Guides
    • System Configuration
      • System Configuration Guide
      • scylla.yaml
      • ScyllaDB Snitches
      • Configuration Parameters
    • Benchmarking ScyllaDB
    • ScyllaDB Diagnostic Tools
  • ScyllaDB for Developers
    • Develop with ScyllaDB
    • Tutorials and Example Projects
    • Learn to Use ScyllaDB
    • ScyllaDB Alternator
    • ScyllaDB Drivers
  • CQL Reference
    • CQLSh: the CQL shell
    • Reserved CQL Keywords and Types (Appendices)
    • Compaction
    • Consistency Levels
    • Consistency Level Calculator
    • Data Definition
    • Data Manipulation
      • SELECT
      • Selecting an excerpt
      • INSERT
      • UPDATE
      • DELETE
      • BATCH
    • Data Types
    • Definitions
    • Global Secondary Indexes
    • Expiring Data with Time to Live (TTL)
    • Functions
    • CQL Guardrails
    • Wasm support for user-defined functions
    • JSON Support
    • Materialized Views
    • DESCRIBE SCHEMA
    • Configuring a Cluster with CQL
    • Service Levels
    • ScyllaDB CQL Extensions
  • Alternator: DynamoDB API in ScyllaDB
    • Getting Started With ScyllaDB Alternator
    • ScyllaDB Alternator for DynamoDB users
    • Alternator-specific APIs
    • Reducing network costs in Alternator
    • Alternator Vector Search
    • Alternator client libraries
  • Features
    • Lightweight Transactions
    • Global Secondary Indexes
    • Local Secondary Indexes
    • Materialized Views
    • Counters
    • Change Data Capture
      • CDC Overview
      • The CDC Log Table
      • Basic operations in CDC
      • CDC Streams
      • CDC Stream Changes
      • Querying CDC Streams
      • Advanced column types
      • Preimages and postimages
      • Data Consistency in CDC
    • Workload Attributes
    • Workload Prioritization
    • Backup and Restore
    • Incremental Repair
    • Automatic Repair
    • Vector Search
    • Full-Text Search
    • Pattern Search
  • ScyllaDB Architecture
    • Data Distribution with Tablets
    • ScyllaDB Ring Architecture
    • ScyllaDB Fault Tolerance
    • Consistency Level Console Demo
    • ScyllaDB Anti-Entropy
      • ScyllaDB Hinted Handoff
      • ScyllaDB Read Repair
      • ScyllaDB Repair
    • SSTable
      • ScyllaDB SSTable - 2.x
      • ScyllaDB SSTable - 3.x
    • Compaction Strategies
    • Raft Consensus Algorithm in ScyllaDB
    • Zero-token Nodes
  • Troubleshooting ScyllaDB
    • Errors and Support
      • Report a ScyllaDB problem
      • Error Messages
      • Change Log Level
    • ScyllaDB Startup
      • Ownership Problems
      • ScyllaDB will not Start
    • Cluster and Node
      • Handling Node Failures
      • Failure to Add, Remove, or Replace a Node
      • Failed Decommission Problem
      • Cluster Timeouts
      • Node Joined With No Data
      • NullPointerException
      • Failed Schema Sync
    • Data Modeling
      • ScyllaDB Large Partitions Table
      • ScyllaDB Large Rows and Cells Table
      • Large Partitions Hunting
      • Failure to Update the Schema
    • Data Storage and SSTables
      • Space Utilization Increasing
      • Disk Space is not Reclaimed
      • SSTable Corruption Problem
      • Pointless Compactions
      • Limiting Compaction
    • CQL
      • Time Range Query Fails
      • COPY FROM Fails
      • CQL Connection Table
    • ScyllaDB Monitor and Manager
      • Manager and Monitoring integration
      • Manager lists healthy nodes as down
    • Installation and Removal
      • Removing ScyllaDB on Ubuntu breaks system packages
  • Knowledge Base
    • Upgrading from experimental CDC
    • Compaction
    • Consistency in ScyllaDB
    • Counting all rows in a table is slow
    • CQL Query Does Not Display Entire Result Set
    • When CQLSh query returns partial results with followed by “More”
    • Run ScyllaDB and supporting services as a custom user:group
    • Customizing CPUSET
    • Decoding Stack Traces
    • Snapshots and Disk Utilization
    • DPDK mode
    • Debug your database with Flame Graphs
    • Efficient Tombstone Garbage Collection in ICS
    • How to Change gc_grace_seconds for a Table
    • Gossip in ScyllaDB
    • How does ScyllaDB LWT Differ from Apache Cassandra ?
    • Map CPUs to ScyllaDB Shards
    • ScyllaDB Memory Usage
    • NTP Configuration for ScyllaDB
    • POSIX networking for ScyllaDB
    • ScyllaDB consistency quiz for administrators
    • Recreate RAID devices
    • How to Safely Increase the Replication Factor
    • ScyllaDB and Spark integration
    • Increase ScyllaDB resource limits over systemd
    • ScyllaDB Seed Nodes
    • How to Set up a Swap Space
    • ScyllaDB Snapshots
    • ScyllaDB payload sent duplicated static columns
    • Stopping a local repair
    • System Limits
    • How to flush old tombstones from a table
    • Time to Live (TTL) and Compaction
    • ScyllaDB Nodes are Unresponsive
    • Update a Primary Key
    • Using the perf utility with ScyllaDB
    • Configure ScyllaDB Networking with Multiple NIC/IP Combinations
  • Reference
    • AWS Images
    • Azure Images
    • GCP Images
    • Configuration Parameters
    • Glossary
    • Limits
    • API Reference
      • Authorization Cache
      • Cache Service
      • Column Family
      • Commit Log
      • Compaction Manager
      • Endpoint Snitch Info
      • Error Injection
      • Failure Detector
      • Gossiper
      • Hinted Handoff
      • LSA
      • Messaging Service
      • Raft
      • Storage Proxy
      • Storage Service
      • Stream Manager
      • System
      • Task Manager Test
      • Task Manager
      • Tasks
    • Metrics
  • ScyllaDB FAQ
  • 2024.2 and earlier documentation
Docs Tutorials University Contact Us About Us
© 2026, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 20 Oct 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3