Search
$text and MongoDB Search with indexes that see every committed write.
TeselaDB implements $text and MongoDB Search (formerly Atlas Search): $search, $searchMeta, the search index
commands and their operators, analyzers, synonyms and field types. You do not need a separate process: the indexes live
on the same nodes as the data.
Create an index and search
JavaScript
db.articles.createSearchIndex({
name: "default",
definition: { mappings: { dynamic: true } },
});
db.articles.aggregate([
{ $search: { text: { query: "automatic replication", path: ["title", "body"] } } },
{ $limit: 10 },
{ $project: { title: 1, score: { $meta: "searchScore" } } },
]);What changes from MongoDB
- Search indexes are consistent: a search sees the writes committed before it. In MongoDB they can take a while to appear.
- Scores use the statistics of the whole collection, even when it is split over many ranges, and are the same on every replica. They match those of a MongoDB replica set with the same documents.
Classic text
$text with a text index works as in MongoDB, with its score ($meta: "textScore").
For semantic search with vectors, see Vector search.