CipherStash Documentation


DynamicMatch supports full text search on string fields when the fields are not known ahead of time.

Supported Types

  • string

Index Definition

DynamicMatch works just like Match except that it automatically indexes all strings fields that it finds within a document - even when the documents in a collection do not have a consistent structure.

import { CollectionSchema, downcase, ngram } from "@cipherstash/stashjs"

CollectionSchema.define<Employee>("employees").indexedWith(mapping => ({
  allText: mapping.DynamicMatch({
    tokenFilters: [downcase],
    tokenizer: ngram({ tokenLength: 3 })

Supported Query Operations

  • match (performs full text search)
let queryResult1 = await employees.all(
  employee => employee.allText.match("CEO")