Dynamic match query
By adding a dynamic match index to the schema, all string fields will be indexed.
Using a dynamic match query you are able to do a full text search on all string
fields.
import { Stash } from "@cipherstash/stashjs"
import { generateSchemaWithMapping } from "./schemaWithMapping";
const matchQuery = async () => {
try {
const stash = await Stash.connect();
const movieSchema = await generateSchemaWithMapping()
const movies = await stash.loadCollection(movieSchema)
const queryResult = await movies.query(
movie => movie.allTextDynamicMatch.match("odyssey")
)
console.log(queryResult)
return queryResult
} catch (err) {
console.error(err)
console.error(`Could not query collection! Reason: ${JSON.stringify(err)}`)
return
}
}
matchQuery()