Atlas Search

MongoDB Search Indexes and Queries

MongoDB 1,815 Search, formerly Atlas 1,815 Search, puts an Apache Lucene 129 index beside your data. A companion process, mongot, tails the oplog, keeps that index in sync and answers the $search aggregation stage. Lucene does the work, so you get analyzers, fuzzy matching, synonyms, autocomplete, highlighting and faceting. The index is JSON rather than a key pattern; dynamic: true covers every field it can infer, but naming fields fixes the analyzer per field.

A MongoDB Search index definition and a $search query (Atlas required)
db.articles.createSearchIndex('article_search', 'search', {
  mappings: { dynamic: false, fields: {
    title: [{ type: 'string', analyzer: 'lucene.english' },
            { type: 'autocomplete', tokenization: 'edgeGram' }],
    body: { type: 'string', analyzer: 'lucene.english' }, views: { type: 'number' } } }
});
db.articles.aggregate([
  { $search: { index: 'article_search', highlight: { path: 'title' }, compound: {
      should: [{ text: { query: 'dokcer volums', path: ['title', 'body'],
                         fuzzy: { maxEdits: 2 }, score: { boost: { value: 3 } } } }],
      filter: [{ range: { path: 'views', gte: 100 } }] } } },
  { $project: { title: 1, score: { $meta: 'searchScore' } } }
]);

Both statements fail on Community, which is why the listing carries no output. They return SearchNotEnabled: Using $search and $vectorSearch aggregation stages requires additional configuration. Please connect to Atlas or an AtlasCLI 1,815 local deployment. You need an Atlas cluster (the M0 free tier of Free Atlas Cluster includes Search), Enterprise Advanced with your own mongot, or a local deployment from atlas deployments setup. Two habits matter there. Keep $search first and filter inside it, since a $match afterwards discards work Lucene already paid for; and treat searchScore as opaque, an unbounded BM25 value that orders results but must never be shown as a percentage.