Was this page helpful?
Reference for Vector Search¶
This page is a technical reference for working with vector search in ScyllaDB. It includes the CQL syntax needed to define and query vector data, along with the API endpoints for working with vector search. Use it as a quick lookup when writing queries or building integrations.
CQL Reference¶
Create Vector Table¶
Syntax:
CREATE TABLE IF NOT EXISTS `keyspace.table` ( column1 `type`, column2 `type`, column3 `type`, vector_column_name vector<float, n>, );
Example:
CREATE TABLE IF NOT EXISTS mykeyspace.pictures ( userid uuid, pictureid uuid, body text, posted_by text, picture_vector vector<float, 64>, PRIMARY KEY (userid, pictureid, posted_by) );
Create Vector Index¶
Syntax:
CREATE CUSTOM INDEX [ IF NOT EXISTS ] `index_name`
ON `table_name` (`vector_column_name`)
USING 'vector_index'
[WITH OPTIONS = ];
Example:
CREATE CUSTOM INDEX vectorIndex
ON pictures (picture_vector)
USING 'vector_index'
WITH OPTIONS = {'similarity_function': 'COSINE', 'maximum_node_connections': '16'};
See Global Secondary Indexes - Vector Index in the ScyllaDB documentation for a list of available options.
Drop Vector Index¶
Syntax:
DROP INDEX [ IF EXISTS ] `index_name`
Example:
DROP INDEX [ IF EXISTS ] vectorIndex
Run Similarity Search¶
Syntax:
SELECT `column1`, `column2`, ...
FROM `keyspace.table`
ORDER BY `vector_column_name`
ANN OF `vector`
LIMIT `integer`;
Example:
SELECT pictureid
FROM mykeyspace.pictures
ORDER BY picture_vector ANN OF [
0.12,0.34,0.56,0.78,0.91,0.15,0.62,0.48,0.22,0.31,
0.40,0.67,0.53,0.84,0.19,0.72,0.63,0.54,0.26,0.33,
0.11,0.09,0.27,0.41,0.69,0.82,0.57,0.38,0.71,0.46,
0.55,0.64,0.17,0.81,0.23,0.95,0.66,0.35,0.44,0.59,
0.02,0.75,0.28,0.16,0.92,0.88,0.47,0.13,0.99,0.21,
0.32,0.83,0.45,0.04,0.86,0.25,0.36,0.73,0.07,0.61,
0.52,0.14,0.68,0.05
]
LIMIT 3;
API Reference¶
Create a Vector Search Cluster¶
Create a new cluster with vector search enabled:
curl -X POST "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/cluster" \ -H "Authorization: Bearer YOUR_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "clusterName": "my-vector-cluster", "cloudProviderId": 1, "regionId": 1, "scyllaVersion":"2025.4.0~rc0-0.20251001.6969918d3151", "numberOfNodes": 3, "instanceId": 62, "freeTier": true, "replicationFactor": 3, "vectorSearch": { "defaultNodes": 1, "defaultInstanceTypeId": 175 } }'
Deploy Vector Search Nodes¶
Deploy vector search nodes in the specified datacenter (DC):
curl -X POST "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/cluster/{CLUSTER_ID}/dc/{DC_ID}/vector-search" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"defaultNodes": 1,
"defaultInstanceTypeId": 175
}'
Delete Vector Search Nodes¶
Delete vector search nodes from the specified datacenter (DC):
curl -X DELETE "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/cluster/{CLUSTER_ID}/dc/{DC_ID}/vector-search" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
Get Vector Search Nodes¶
Get information about vector search nodes in the specified datacenter (DC):
curl -X GET "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/cluster/{CLUSTER_ID}/dc/{DC_ID}/vector-search" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
Example response:
{
"data": {
"availabilityZones": [
{
"azid": "use1-az4",
"nodes": [
{
"id": 337,
"instanceTypeId": 175,
"status": "ACTIVE"
}
]
},
{
"azid": "use1-az5",
"nodes": [
{
"id": 338,
"instanceTypeId": 175,
"status": "ACTIVE"
}
]
},
{
"azid": "use1-az2",
"nodes": [
{
"id": 339,
"instanceTypeId": 175,
"status": "ACTIVE"
}
]
}
]
}
}
Get Your Account ID¶
curl -X GET "https://api.cloud.scylladb.com/account/default" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response:
{
"error": "",
"data": {
"accountId": 12345,
"name": "my-account",
"userId": "12345"
}
}
Get Your Cluster ID¶
curl -X GET "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/clusters" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Get Your DC ID¶
curl -X GET "https://api.cloud.scylladb.com/account/{ACCOUNT_ID}/cluster/{CLUSTER_ID}/dcs" \
-H "Authorization: Bearer YOUR_API_TOKEN"