VSETATTR

VSETATTR key element "{ JSON obj }"
Available since:
Redis Open Source 8.0.0
Time complexity:
O(1)
Compatibility:
Redis Software and Redis Cloud compatibility

Associate a JSON object with an element in a vector set. Use this command to store attributes that can be used in filtered similarity searches with VSIM.

You can also update existing attributes or delete them by setting an empty string.

VSETATTR key element "{\"type\": \"fruit\", \"color\": \"red\"}"

To remove attributes, pass an empty JSON string:

VSETATTR key element ""

Required arguments

key

is the name of the key that holds the vector set.

element

is the name of the element whose attributes you want to set or remove.

json

is the JSON string with the attributes of the element. Use an empty string ("") to delete the attributes. The string is stored as given, without validation. Elements whose attributes are not valid JSON are treated as not matching by the FILTER option of VSIM.

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
❌ Active-Active
✅ Standard
❌ Active-Active

Return information

Integer reply: 0 if either the key or element does not exist; 1 if the attributes were set or deleted.
RATE THIS PAGE
Back to top ↑