db.collection.getSearchIndexes() retrieves Atlas Search or Vector Search index configurations from a MongoDB collection. Use it to inspect index definitions and verify that an index is ready and queryable. section 11.6 section 14.5.3
Use the method in two ways:
- Pass an index name to retrieve that index's configuration. section 11.6
- Omit the argument to retrieve configurations for every index in the collection. section 11.6
- Check returned status and queryable fields before relying on a newly created index. section 13.5.2 section 14.5.3
Verify a vector search index
Switch to the target database and run db.mongodb.getSearchIndexes(). The result can show the default vectorSearch index, READY status, queryable: true, the embedding path, 1,536 dimensions, and cosine similarity. section 14.5.3
db.embedded_movies.getSearchIndexes()
[
{
id: '66afe77ea85a4d1064106885',
name: 'default',
type: 'search',
status: 'READY',
queryable: true,
latestVersion: 0,
latestDefinition: {
mappings: {
dynamic: true,
fields: {
plot_embedding: {
type: 'knnVector',
dimensions: 1536,
similarity: 'euclidean'
}
}
}
}
}
]
Inspect a complete returned configuration, including its identifier, type, readiness, queryability, and knnVector definition. section 13.5.2
The method is useful after createSearchIndex() or Atlas CLI index creation, especially in local development and test workflows. It reports configuration; creating, updating, and dropping indexes use separate operations. section 13.6 section 11.6
