Regex Filtering
Beyond =~: How Milvus 3.0 Turns Regex into a Native Database Filter

Beyond =~: How Milvus 3.0 Turns Regex into a Native Database Filter

8/5/2026 · Buqian Zheng

What this post added

Introduced native regex filtering operators (`=~`, `!~`) into Milvus 3.0, moving regex processing from application-side post-processing to the database query path. This involves validating user-supplied patterns using RE2 for predictable linear execution time, preserving null and negation semantics, integrating regex with query planning and indexing, and implementing optimizations such as rewriting simple regex to cheaper string operations (equality, prefix, suffix), treating regex as a heavy predicate to be executed after cheaper conditions, using Volnitsky string search as a prefilter for patterns with stable literals, and leveraging NGRAM indexing for candidate generation and subsequent RE2 verification. The implementation also addresses the correct handling of `!~` with UNKNOWN values in three-valued logic.

Read the original post ↗