VSETATTR

Syntax
VSETATTR key element "{ JSON obj }"
Available since:
Redis CE 8.0.0
Time complexity:
O(1)

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 a valid JSON string. Use an empty string ("") to delete the attributes.

RESP2 Reply

One of the following:

  • Integer reply: 0 if either the key or element does not exist; 1 if the attributes were successfully added to the element.
  • Simple error reply for improperly specified attribute string.

RESP3 Reply

One of the following:

  • Boolean reply: false if either the key or element does not exist; true if the attributes were successfully added to the element.
  • Simple error reply for improperly specified attribute string.

RATE THIS PAGE
Back to top ↑