For AI agents: this page is also available as Markdown at /docs/multi-vector-fields.md. Every docs page is: add .md to its URL. llms.txt lists them all.
Multi-vector fields
A multi-vector field holds many vectors per document, typically one per passage or chunk. It is a vector field like any other, except that a search scores each document by the single vector that best matches the query and returns one hit per document. Use it for long documents that one embedding does not represent well.
#Define a multi-vector field
Set multi: true on a vector field in the WarpSearch schema, or name the field with the _vs suffix. Send the fields object when you create the collection, or later to PUT /v1/collections/{collection}/schema:
{
"fields": {
"passages_vs": {
"type": "vector",
"dims": 768,
"metric": "cosine",
"multi": true
}
}
}
Map the field as rank_vectors, dense_vector or OpenSearch's knn_vector. All three hold several vectors per document. rank_vectors uses cosine unless you add "similarity" (a WarpSearch extension):
{ "mappings": { "properties": { "passages_vs": { "type": "rank_vectors", "dims": 768 } } } }
Unlike Elasticsearch, dense_vector and knn_vector accept an array of vectors too, scored the same way. A field the collection already defines single-valued, for example through the schema API, stays single-valued, and a document that sends several vectors to it fails with an error that says so.
As with any vector field, a _vs field is storage only until you give it a metric, so define dims and metric explicitly. Exact and approximate search, filters, similarity and the tuning knobs work as described in Vector search.
#Write the vectors
Send an array of arrays. A bare array is accepted as a list of one vector. A multi-vector field is returned as a list of vectors, even when the document sent one.
{
"id": "doc-17",
"title_t": "Shipping and returns policy",
"passages_vs": [
[0.12, 0.40, 0.05],
[0.33, 0.21, 0.58],
[0.09, 0.71, 0.14]
]
}
The example vectors have 3 components to keep it short; yours must match the field's dims.
Every vector must have the same dimension, and every element must be a finite float32. Replacing a document replaces all of its vectors. Each vector counts toward index size, so a document with 50 chunks costs about 50 times the storage of a single-vector document. See Ingesting documents for batching.
#Query
Query a multi-vector field like a single-vector one, with one query vector, on POST /v1/search/{collection}:
{
"language": "es",
"query": {
"knn": {
"field": "passages_vs",
"query_vector": [0.30, 0.25, 0.55],
"k": 10
}
},
"filters": [{ "term": { "lang_s": "en" } }],
"limit": 10,
"fields": ["id", "title_t"]
}
POST /compat/es/{collection}/_search:
{
"knn": {
"field": "passages_vs",
"query_vector": [0.30, 0.25, 0.55],
"k": 10,
"filter": { "term": { "lang_s": "en" } }
},
"size": 10,
"_source": ["title_t"]
}
A document's score is the best similarity between the query and any of its vectors. The result has one hit per document, however many of its vectors were close, and k counts documents, not vectors. With a similarity threshold, a document stays if its best vector passes.
#Chunking pattern for long documents
A common recipe:
- Split the document into passages. Pick a size your embedding model handles well, often a few hundred tokens, with a little overlap between neighbors.
- Embed each passage and write all of them into one multi-vector field on the document.
- Search by the query's embedding. The best passage decides the document's rank.
The vector field holds only vectors. To show the matching passage, store the chunk text yourself and look it up after the search. Two layouts are common:
| Layout | How it works | Use it when |
|---|---|---|
| One document, many vectors | A _vs field on the parent document. Chunk text lives in your own storage, keyed by document id. | You only need the parent document back, ranked by its best chunk. |
| One document per chunk | Each chunk is a document with a parent_id_s field, its own text and a single vector. | You need the matching chunk text in the response, or per-chunk filters. |
A search returns the score, not which vector won. To display the winning passage, the second layout is simplest, because the hit is the chunk itself.
#One result per parent
With one document per chunk, collapse on the parent id to get one result per parent. collapse goes beside the knn section:
{
"language": "es",
"query": {
"knn": { "field": "chunk_v", "query_vector": [0.30, 0.25, 0.55], "k": 50 },
"collapse": { "field": "parent_id_s" }
},
"limit": 10,
"fields": ["parent_id_s", "chunk_t"]
}
{
"knn": { "field": "chunk_v", "query_vector": [0.30, 0.25, 0.55], "k": 50 },
"collapse": { "field": "parent_id_s" },
"size": 10,
"_source": ["parent_id_s", "chunk_t"]
}
Each parent is represented by its best chunk, which carries the text you want to show. A group's score is its best member's score. Filters and deletes apply before groups are chosen. By default k counts chunks, not parents. Add "unit": "groups" to the knn section and k counts parents instead; see Nearest groups.
When a multi-vector field is combined with groups, each document is first scored by its best vector, and documents then compete inside their group. See Nearest groups and the collapse section of Searching.
#Multi-vector search in hybrid queries
A multi-vector kNN query can be a knn retriever in an rrf or linear fusion, next to a keyword query. See Hybrid search.
#Late interaction (MaxSim)
Models such as ColBERT and ColPali score each query token vector against its best matching document vector, then sum those scores. This differs from best-single-vector scoring.
The query API accepts one query vector and does not support summed MaxSim. multi_vector_scoring is not a supported schema option. Retrieve candidates first, then compute MaxSim in your application using the token vectors you retain. See Reranking.
#Limits and tips
- A multi-valued vector field cannot be a collapse key.
- Scores are best-single-vector scores. Documents with many vectors are not penalized or favored by how many they hold, but a document with more chunks has more chances to match by luck. Keep chunk sizes consistent.
- Search cost grows with the total number of vectors, not the number of documents. Approximate indexes help once segments are large enough, see When indexes get built.
- To reduce storage for many-chunk collections, consider
truncate_dimswith an MRL model.