We are excited to announce that creating search indexes on views is now Generally Available.
Creating indexes on compatible views enables you to optimize your data for search without disrupting other consumers or duplicating data. Currently, Atlas Search supports views only with the following stages:
$match with the $expr operator for partially indexing a collection
$addFields to derive new fields to search on
$set to remodel existing data into compatible types (e.g. Decimal128 to Double, or flattening embeddedDocuments)
I have one question. The docs states that:
“For indexes created on views, Atlas Search applies the transformations or filters that you define in the view pipeline at query-time and at replication-time.”
I understand that the view is always applied at replication-time, but the query-time part is only true if i query the search index using the view, right? If i query the search index using the regular collection then the view should not be applied during query-time?
This is great news, thanks for sharing. I’ve been trying to use this, but after creating the view I’m not being able to create a search index on it. The message I get in Compass is “Readonly views may not contain indexes.”. Any ideas?