I am using MongoDB Atlas Search and want to create a partial search index where:
Only specific documents are indexed based on a field condition (e.g., status: "active").Only specific fields are indexed to reduce the index size.I found that MongoDB Atlas Search allows filtering documents during indexing using the filter option and also supports selective field indexing using mappings. However, I'm unsure how to properly configure both together.
What I’ve Tried:I attempted to create an index with the following configuration:
"mappings": {"dynamic": false,"fields": {"title": {"type": "string" },"description": {"type": "string" } } },"filter": {"equals": {"path": "status","value": "active" } }}
However, I’m not sure if this is the correct approach, and I want to confirm:
Does this configuration ensure that only documents with status: "active" are indexed?Will this index only the title and description fields, or do I need a different mappings setup?Is there a better way to define a partial search index in MongoDB Atlas?Any guidance or best practices would be greatly appreciated!