-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_dummy.sh
More file actions
45 lines (37 loc) · 1.47 KB
/
load_dummy.sh
File metadata and controls
45 lines (37 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# =========================
# Configuration variables
# =========================
max_collection=4
collection_name="dummy_collection"
api_url="http://192.168.1.210:6333"
points_per_collection=5
vector_dim=4
# =========================
# Create and populate collections
# =========================
for i in $(seq 1 $max_collection); do
col="${collection_name}${i}"
echo "Creating collection '$col'..."
# Create collection (will fail gracefully if it already exists)
curl -s -X PUT "$api_url/collections/$col" \
-H "Content-Type: application/json" \
-d "{\"vectors\": {\"size\": $vector_dim, \"distance\": \"Cosine\"}}" > /dev/null
echo "Inserting $points_per_collection dummy vectors into '$col'..."
POINTS_JSON="["
for j in $(seq 1 $points_per_collection); do
# Generate random vector values between 0 and 1
VECTOR=$(awk -v d=$vector_dim 'BEGIN{srand(); for(i=1;i<=d;i++){printf "%f", rand(); if(i<d){printf ","}}}')
POINTS_JSON+="{\"id\":$j,\"vector\":[$VECTOR],\"payload\":{\"dummy\":true}}"
if [ $j -lt $points_per_collection ]; then
POINTS_JSON+=","
fi
done
POINTS_JSON+="]"
# Insert points
curl -s -X PUT "$api_url/collections/$col/points" \
-H "Content-Type: application/json" \
-d "{\"points\": $POINTS_JSON}" > /dev/null
echo "✅ Collection '$col' populated with $points_per_collection dummy points."
done
echo "All dummy collections created successfully!"