Class VectorSearchIndexDefinition

java.lang.Object
com.mongodb.client.model.VectorSearchIndexDefinition
All Implemented Interfaces:
SearchIndexDefinition, Bson

public final class VectorSearchIndexDefinition extends Object implements SearchIndexDefinition
A vector search index definition, producing a document of the form {"fields": [...]}.

Instances are created via SearchIndexDefinition.vectorSearch(Bson...).

Since:
5.8
See Also:
  • Method Details

    • storedSource

      public VectorSearchIndexDefinition storedSource(Bson storedSource)
      Creates a new VectorSearchIndexDefinition with the specified stored source configuration.

      The stored source configuration controls which fields are stored in the index and can be returned without reading the full document from the collection.

      Parameters:
      storedSource - a document specifying the stored source configuration, e.g., {"include": ["field1", "field2"]} or {"exclude": ["field3"]}
      Returns:
      a new VectorSearchIndexDefinition with the stored source configuration
      Since:
      5.8
    • toBsonDocument

      public <TDocument> BsonDocument toBsonDocument(Class<TDocument> documentClass, CodecRegistry codecRegistry)
      Specified by:
      toBsonDocument in interface Bson
    • toString

      public String toString()
      Overrides:
      toString in class Object