Search with vector embeddings
This page shows you how to use Firestore to perform K-nearest neighbor (KNN) vector searches using the following techniques:
- Store vector values
- Create and manage KNN vector indexes
- Make a K-nearest-neighbor (KNN) query using one of the supported vector distance measures
Before you begin
Before you store embeddings in Firestore, you must generate vector embeddings. Firestore does not generate the embeddings. You can use a service such as Vertex AI to create vector values, for example, text embeddings from your Firestore data. You can then store these embeddings back in Firestore documents.
To learn more about embeddings, see What are embeddings?
To learn how to get text embeddings with Vertex AI, see Get text embeddings.
Store vector embeddings
The following examples demonstrate how to store vector embeddings in Firestore.
Write operation with a vector embedding
The following example shows how to store a vector embedding in a Firestore document:
Python
Node.js
import { Firestore,