Skip to main content

Hybrid Search

Combine vector similarity with keyword search using Reciprocal Rank Fusion (RRF).

POST /v1/collections/{name}/hybrid_search

Request

Headers:

x-api-key: your-api-key
Content-Type: application/json

Path Parameters:

ParameterDescription
nameCollection name

Body:

FieldTypeRequiredDescription
query_textstringText query for keyword matching.
vectorfloat[]Query vector for semantic similarity. Now optional -- if omitted, the backend auto-embeds query_text to generate the vector.
kintegerNumber of results to return. Default: 10
offsetintegerPagination offset. Default: 0
alphafloatBlend factor: 1.0 = pure vector, 0.0 = pure keyword. Default: 0.5
filtersobjectMetadata filters
include_timingbooleanDefault: false. When true, the response includes a timing_ms object with embedding_ms, search_ms, and total_ms breakdowns.

Examples

With vector:

curl -X POST http://localhost:8000/v1/collections/articles/hybrid_search \
-H "x-api-key: test-key" \
-H "Content-Type: application/json" \
-d '{
"query_text": "machine learning transformers",
"vector": [0.1, 0.2, 0.3],
"k": 10,
"alpha": 0.7
}'

Text only (auto-embed) with timing:

curl -X POST http://localhost:8000/v1/collections/articles/hybrid_search \
-H "x-api-key: test-key" \
-H "Content-Type: application/json" \
-d '{
"query_text": "machine learning transformers",
"k": 10,
"alpha": 0.7,
"include_timing": true
}'

Response

{
"status": "success",
"data": {
"results": [
{
"external_id": "doc-88",
"score": 0.9731,
"metadata": {"title": "Transformers explained"}
},
{
"external_id": "doc-12",
"score": 0.9412,
"metadata": {"title": "Intro to machine learning"}
}
]
}
}

With timing:

{
"status": "success",
"data": {
"results": [
{
"external_id": "doc-88",
"score": 0.9731,
"metadata": {"title": "Transformers explained"}
}
],
"timing_ms": {
"embedding_ms": 12.1,
"search_ms": 5.3,
"total_ms": 17.4
}
}
}

Errors

CodeReason
400Vector dimension mismatch
404Collection not found
401Missing or invalid API key