Python
from actian_vectorai_client import VectorAIClient
import random
with VectorAIClient("localhost:6574") as client:
# Execute multiple searches at once
queries = [
{"vector": [random.gauss(0, 1) for _ in range(64)], "limit": 3}
for _ in range(3)
]
batch_results = client.points.search_batch("my_collection", queries)
for i, results in enumerate(batch_results):
ids = [r.id for r in results]
print(f"Query {i + 1}: top IDs = {ids}")import { VectorAIClient } from '@actian/vectorai-client';
const client = new VectorAIClient('localhost:6574');
const batchResults = await client.points.searchBatch('my_collection', [
{ vector: [0.1, 0.2, 0.3, 0.4], limit: 3 },
{ vector: [0.5, 0.6, 0.7, 0.8], limit: 3 },
]);
console.log(`Batch search: ${batchResults.length} result sets`);
for (let i = 0; i < batchResults.length; i++) {
console.log(` Query ${i}: ${batchResults[i].length} results`);
}
client.close();curl -X POST "http://localhost:6575/collections/my_collection/points/search/batch" \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer <admin-jwt-or-access-token>' \
-d '{
"searches": [
{"vector": [0.1, 0.2, 0.3, 0.4], "limit": 3},
{"vector": [0.5, 0.6, 0.7, 0.8], "limit": 3}
]
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "6575",
CURLOPT_URL => "http://localhost:6575/collections/{collection_name}/points/search/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'searches' => [
[
'vector' => [
0.1,
0.2,
0.3,
0.4
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
],
[
'vector' => [
0.5,
0.6,
0.7,
0.8
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
],
[
'vector' => [
0.9,
0.8,
0.7,
0.6
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:6575/collections/{collection_name}/points/search/batch"
payload := strings.NewReader("{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:6575/collections/{collection_name}/points/search/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:6575/collections/{collection_name}/points/search/batch")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"usage": {
"hardware": null
},
"time": 0.0000706,
"status": "ok",
"result": [
[
{
"id": 1,
"version": 0,
"score": 1,
"payload": null,
"vector": null
},
{
"id": 3,
"version": 0,
"score": 0.9843740463256836,
"payload": null,
"vector": null
},
{
"id": 2,
"version": 0,
"score": 0.9688639640808105,
"payload": null,
"vector": null
}
],
[
{
"id": 2,
"version": 0,
"score": 1,
"payload": null,
"vector": null
},
{
"id": 3,
"version": 0,
"score": 0.9973233938217163,
"payload": null,
"vector": null
}
]
]
}{
"status": {
"error": "<string>"
},
"time": 123
}Search
Batch search
Execute multiple search queries in a single request. This is more efficient than sending individual search requests when you have several queries to run.
POST
/
collections
/
{collection_name}
/
points
/
search
/
batch
Python
from actian_vectorai_client import VectorAIClient
import random
with VectorAIClient("localhost:6574") as client:
# Execute multiple searches at once
queries = [
{"vector": [random.gauss(0, 1) for _ in range(64)], "limit": 3}
for _ in range(3)
]
batch_results = client.points.search_batch("my_collection", queries)
for i, results in enumerate(batch_results):
ids = [r.id for r in results]
print(f"Query {i + 1}: top IDs = {ids}")import { VectorAIClient } from '@actian/vectorai-client';
const client = new VectorAIClient('localhost:6574');
const batchResults = await client.points.searchBatch('my_collection', [
{ vector: [0.1, 0.2, 0.3, 0.4], limit: 3 },
{ vector: [0.5, 0.6, 0.7, 0.8], limit: 3 },
]);
console.log(`Batch search: ${batchResults.length} result sets`);
for (let i = 0; i < batchResults.length; i++) {
console.log(` Query ${i}: ${batchResults[i].length} results`);
}
client.close();curl -X POST "http://localhost:6575/collections/my_collection/points/search/batch" \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer <admin-jwt-or-access-token>' \
-d '{
"searches": [
{"vector": [0.1, 0.2, 0.3, 0.4], "limit": 3},
{"vector": [0.5, 0.6, 0.7, 0.8], "limit": 3}
]
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "6575",
CURLOPT_URL => "http://localhost:6575/collections/{collection_name}/points/search/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'searches' => [
[
'vector' => [
0.1,
0.2,
0.3,
0.4
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
],
[
'vector' => [
0.5,
0.6,
0.7,
0.8
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
],
[
'vector' => [
0.9,
0.8,
0.7,
0.6
],
'limit' => 3,
'with_payload' => true,
'with_vector' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:6575/collections/{collection_name}/points/search/batch"
payload := strings.NewReader("{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:6575/collections/{collection_name}/points/search/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:6575/collections/{collection_name}/points/search/batch")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"searches\": [\n {\n \"vector\": [\n 0.1,\n 0.2,\n 0.3,\n 0.4\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.5,\n 0.6,\n 0.7,\n 0.8\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n },\n {\n \"vector\": [\n 0.9,\n 0.8,\n 0.7,\n 0.6\n ],\n \"limit\": 3,\n \"with_payload\": true,\n \"with_vector\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"usage": {
"hardware": null
},
"time": 0.0000706,
"status": "ok",
"result": [
[
{
"id": 1,
"version": 0,
"score": 1,
"payload": null,
"vector": null
},
{
"id": 3,
"version": 0,
"score": 0.9843740463256836,
"payload": null,
"vector": null
},
{
"id": 2,
"version": 0,
"score": 0.9688639640808105,
"payload": null,
"vector": null
}
],
[
{
"id": 2,
"version": 0,
"score": 1,
"payload": null,
"vector": null
},
{
"id": 3,
"version": 0,
"score": 0.9973233938217163,
"payload": null,
"vector": null
}
]
]
}{
"status": {
"error": "<string>"
},
"time": 123
}Authorizations
Admin JWT or access token for authenticating requests to VectorAI DB.
Path Parameters
The name of the collection to search.
Body
application/json
Array of search request objects to execute.
Show child attributes
Show child attributes
⌘I