ExitAmazon OpenSearch Service: scalable vector storage1 / 7
Explanation

Define the embedding contract

How to configure vector indexes and choose managed-domain or Serverless capacity to meet embedding dimensions, similarity search, and workload scaling requirements. · associate

A vector index stores embeddings alongside document text, identifiers, and metadata. Map the embedding field as knn_vector, with its dimension equal to the number of values your embedding model produces. A model that returns 768 values needs dimension: 768. Stored and query vectors must use compatible embedding models and preprocessing; matching dimensions alone does not make different models compatible.

For an approximate nearest-neighbor index, enable index.knn and configure the vector field's method, engine, and similarity measure. HNSW is a common approximate-search method. Choose a supported engine and space_type that match the model's recommendation: cosinesimil compares direction, while l2 measures Euclidean distance. Check support for the complete combination in your deployment.

Create the index with its explicit mapping, then ingest documents containing embeddings and metadata. Search the loaded documents using a compatible query embedding in a k-NN query. The query's k requests nearest neighbors; it does not set the embedding dimension. Treat dimension and indexing method as design choices: changing them generally requires a new index and reindexing.