Run your first vector search
Store a vector containing three numbers, then find it with a similar query. These small coordinates make the request easy to inspect; they are a test fixture, not a real text embedding.
- Connect to the test collectionUse the complete instance address and required credentials.
- Write item-1Store three values with the example dimension and metric.
- Send a similar query vectorKeep the same dimension and metric.
- Find item-1 in the resultA vector write does not create a source table row.
1. Connect
This Bash example uses a new vector-table name, vector_demo. It demonstrates the API with three numbers; these are test coordinates, not a useful text embedding. Add database identity headers when required.
export OC_BASE_URL="https://YOUR_INSTANCE_HOST"
export OC_TENANT="YOUR_TENANT_ID"
# Load OC_BEARER from your secret manager.
: "${OC_BEARER:?Set OC_BEARER first}"2. Write the vector
curl --fail-with-body -X POST "$OC_BASE_URL/v1/tenants/$OC_TENANT/vector/vector_demo/put" \
-H "Authorization: Bearer $OC_BEARER" -H "Content-Type: application/json" \
-d '{"id":"item-1","embedding":[0.1,0.2,0.3],"dim":3,"metric":"cosine"}'Use embedding for a write and set dim to the exact number of values. The first write establishes the vector table’s dimension and metric. Reusing an ID replaces its vector. This call does not create a source row.
3. Search
curl --fail-with-body -X POST "$OC_BASE_URL/v1/tenants/$OC_TENANT/vector/vector_demo/topk" \
-H "Authorization: Bearer $OC_BEARER" -H "Content-Type: application/json" \
-d '{"query":[0.1,0.2,0.3],"dim":3,"k":5,"metric":"cosine"}'The result contains item-1. Use query when searching and the same dimension and metric as the stored vectors. A declared dimension of 768 with only three values is an invalid request.
4. Use real embeddings
Generate the full vector using an embedding model, then search with the same model. Keep IDs aligned with your source records. Use saved embedders and scheduled runs for table columns, or compute vectors in your application.
The vector-record API is a separate interface with index names and namespaces. Its request shape is not interchangeable with this vector-table API.
Next: dimensions, metrics and filtering, worked examples or retrieval-augmented generation.