Interface VectorSearchQuery

All Superinterfaces:
org.bson.conversions.Bson
All Known Subinterfaces:
TextVectorSearchQuery

@Sealed @Beta(SERVER) public interface VectorSearchQuery extends org.bson.conversions.Bson
A query specification for MongoDB Atlas vector search with automated embedding.

This interface provides factory methods for creating type-safe query objects that can be used with the $vectorSearch aggregation pipeline stage for auto-embedding functionality.

Since:
5.7.0
MongoDB Atlas documentation
$vectorSearch
  • Field Summary

    Fields inherited from interface org.bson.conversions.Bson

    DEFAULT_CODEC_REGISTRY
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    Creates a text-based vector search query that will be automatically embedded by the server.

    Methods inherited from interface org.bson.conversions.Bson

    toBsonDocument, toBsonDocument
  • Method Details

    • textQuery

      static TextVectorSearchQuery textQuery(String text)
      Creates a text-based vector search query that will be automatically embedded by the server.

      The server will generate embeddings for the provided text using the model specified in the vector search index definition, or an explicitly specified model via TextVectorSearchQuery.model(String).

      Parameters:
      text - The text to be embedded and searched.
      Returns:
      A TextVectorSearchQuery that can be further configured.