Table of Contents

Class CreateVectorSearchIndexModel<TDocument>

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.dll

Defines a vector index model for pre-embedded vector indexes using strongly-typed C# APIs.

public sealed class CreateVectorSearchIndexModel<TDocument> : CreateVectorSearchIndexModelBase<TDocument>

Type Parameters

TDocument
Inheritance
CreateVectorSearchIndexModel<TDocument>
Inherited Members

Constructors

CreateVectorSearchIndexModel(FieldDefinition<TDocument>, string, VectorSimilarity, int, params FieldDefinition<TDocument>[])

Initializes a new instance of the CreateVectorSearchIndexModel<TDocument> class for a vector index where the vector embeddings are created manually. The required options for VectorSimilarity and the number of vector dimensions are passed to the constructor.

CreateVectorSearchIndexModel(Expression<Func<TDocument, object>>, string, VectorSimilarity, int, params Expression<Func<TDocument, object>>[])

Initializes a new instance of the CreateVectorSearchIndexModel<TDocument> class for a vector index where the vector embeddings are created manually. The required options for VectorSimilarity and the number of vector dimensions are passed to the constructor.

Properties

Similarity

The VectorSimilarity to use to search for top K-nearest neighbors.

Methods

WithExcludedStoredFields(params FieldDefinition<TDocument>[])

Creates a new CreateVectorSearchIndexModel<TDocument> with the given fields configured to be excluded from being stored in the index. This is typically used to exclude vector fields from being stored when other fields should be stored.

WithExcludedStoredFields(params Expression<Func<TDocument, object>>[])

Creates a new CreateVectorSearchIndexModel<TDocument> with the given fields configured to be excluded from being stored in the index. This is typically used to exclude vector fields from being stored when other fields should be stored.

WithIncludedStoredFields(params FieldDefinition<TDocument>[])

Creates a new CreateVectorSearchIndexModel<TDocument> with the given fields configured to be stored in the index. Note that storing full documents might significantly impact performance during indexing and querying. Explicitly storing vector fields is not recommended.

WithIncludedStoredFields(params Expression<Func<TDocument, object>>[])

Creates a new CreateVectorSearchIndexModel<TDocument> with the given fields configured to be stored in the index. Note that storing full documents might significantly impact performance during indexing and querying. Explicitly storing vector fields is not recommended.