Skip to content

Commit 54181c6

Browse files
committed
Add'l commit of vector set docs
1 parent 6b692b9 commit 54181c6

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

content/commands/vadd/index.md

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,37 @@ categories:
1010
- kubernetes
1111
- clients
1212
complexity: O(log(N)) for each element added, where N is the number of elements in the vector set.
13-
description: Add one or more elements to a vector set, or update its vector if it already exists.
13+
description: Add a new element to a vector set, or update its vector if it already exists.
1414
group: vector_set
1515
hidden: false
1616
linkTitle: VADD
1717
since: 1.0.0
18-
summary: Add one or more elements to a vector set, or update its vector if it already exists
18+
summary: Add a new element to a vector set, or update its vector if it already exists
1919
syntax_fmt: "VADD key [REDUCE dim] FP32|VALUES vector element [CAS] [NOQUANT | Q8 | BIN]\n [EF build-exploration-factor] [SETATTR <attributes>] [M <numlinks>]"
2020
title: VADD
2121
---
22-
Sets the specified fields to their respective values in the hash stored at `key`.
23-
24-
This command overwrites the values of specified fields that exist in the hash.
25-
If `key` doesn't exist, a new key holding a hash is created.
26-
27-
## Examples
28-
29-
{{< clients-example cmds_hash hset >}}
30-
> HSET myhash field1 "Hello"
31-
(integer) 1
32-
> HGET myhash field1
33-
"Hello"
34-
> HSET myhash field2 "Hi" field3 "World"
35-
(integer) 2
36-
> HGET myhash field2
37-
"Hi"
38-
> HGET myhash field3
39-
"World"
40-
> HGETALL myhash
41-
1) "field1"
42-
2) "Hello"
43-
3) "field2"
44-
4) "Hi"
45-
5) "field3"
46-
6) "World"
47-
{{< /clients-example >}}
48-
49-
Give these commands a try in the interactive console:
50-
51-
{{% redis-cli %}}
52-
HSET myhash field1 "Hello"
53-
HGET myhash field1
54-
HSET myhash field2 "Hi" field3 "World"
55-
HGET myhash field2
56-
HGET myhash field3
57-
HGETALL myhash
58-
{{% /redis-cli %}}
22+
23+
Add a new element into the vector set specified by the key. The vector can be provided as FP32 blob of values, or as floating point numbers as strings, prefixed by the number of elements (3 in the example):
24+
25+
```
26+
VADD mykey VALUES 3 0.1 1.2 0.5 my-element
27+
```
28+
29+
30+
Meaning of the options:
31+
32+
REDUCE implements random projection, in order to reduce the dimensionality of the vector. The projection matrix is saved and reloaded along with the vector set. Please note that the REDUCE option must be passed immediately before the vector, like in REDUCE 50 VALUES ....
33+
34+
CAS performs the operation partially using threads, in a check-and-set style. The neighbor candidates collection, which is slow, is performed in the background, while the command is executed in the main thread.
35+
36+
NOQUANT forces the vector to be created (in the first VADD call to a given key) without integer 8 quantization, which is otherwise the default.
37+
38+
BIN forces the vector to use binary quantization instead of int8. This is much faster and uses less memory, but has impacts on the recall quality.
39+
40+
Q8 forces the vector to use signed 8 bit quantization. This is the default, and the option only exists in order to make sure to check at insertion time if the vector set is of the same format.
41+
42+
EF plays a role in the effort made to find good candidates when connecting the new node to the existing HNSW graph. The default is 200. Using a larger value, may help to have a better recall. To improve the recall it is also possible to increase EF during VSIM searches.
43+
44+
SETATTR associates attributes to the newly created entry or update the entry attributes (if it already exists). It is the same as calling the VSETATTR attribute separately, so please check the documentation of that command in the filtered search section of this documentation.
45+
46+
M defaults to 16 and is the HNSW famous M parameters. It is the maximum number of connections that each node of the graph have with other nodes: more connections mean more memory, but a better ability to explore the graph. Nodes at layer zero (every node exists at least at layer zero) have M*2 connections, while the other layers only have M connections. This means that, for instance, an M of 64 will use at least 1024 bytes of memory for each node! That is, 64 links * 2 times * 8 bytes pointers, and even more, since on average each node has something like 1.33 layers (but the other layers have just M connections, instead of M*2). If you don't have a recall quality problem, the default is fine, and uses a limited amount of memory.

0 commit comments

Comments
 (0)