Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

VSIM.SET

Last updated
VSIM.SET index key value [value ...]
Group
Vector search
Complexity
O(log N) on average, N being the vectors in the index
Arity
-4 (at least 4 words, counting the command name)
Flags
write, slow
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

VSIM.SET stores a vector under the name key in the vector index index, replacing the key’s previous vector if it had one. Give exactly as many values as the index has dimensions.

key is just a name inside the index: it does not have to exist in the keyspace, and deleting a keyspace key of the same name does not remove its vector. Use the same name as the record it describes (for example the hash holding a document) so search results point you to it. To filter searches by tag, tag that keyspace key with TAG.SET.

Case RESP2 RESP3
New key Integer 1 Integer 1
Existing key, vector replaced Integer 0 Integer 0

Error replies:

  • ERR index 'name' not found
  • ERR expected 3 dimensions, got 2 (with the index’s and your counts).
  • ERR invalid float at dimension 1 for a value that is not a finite number (counting from 0).
127.0.0.1:6379> VSIM.CREATEINDEX points 3 METRIC L2
OK
127.0.0.1:6379> VSIM.SET points p:1 1 0 0
(integer) 1
127.0.0.1:6379> VSIM.SET points p:1 1 0.5 0
(integer) 0
127.0.0.1:6379> VSIM.SET points p:2 1 1
(error) ERR expected 3 dimensions, got 2
127.0.0.1:6379> VSIM.SET points p:2 1 nan 0
(error) ERR invalid float at dimension 1

HotKV-only command.

VSIM.GET, VSIM.DEL, VSIM.SEARCH, VSIM.CREATEINDEX