Skip to main content

Recommendations

Find vectors similar to a stored vector. The source vector is excluded from results.

POST /v1/collections/{name}/recommend/{id}

Request

Headers:

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

Path Parameters:

ParameterDescription
nameCollection name
idExternal ID of the source vector

Body:

FieldTypeRequiredDescription
kintegerNumber of recommendations to return. Default: 10
filtersobjectMetadata filters

Example

curl -X POST http://localhost:8000/v1/collections/articles/recommend/doc-1 \
-H "x-api-key: test-key" \
-H "Content-Type: application/json" \
-d '{"k": 5}'

Response

{
"status": "success",
"data": {
"results": [
{
"external_id": "doc-7",
"score": 0.9521,
"metadata": {"title": "Related Article"}
}
],
"collection": "articles",
"source_id": "doc-1",
"k": 5
}
}

Errors

CodeReason
404Collection or source vector not found
401Missing or invalid API key