{
  "schema_version": 2,
  "id": "commands/vsetattr",
  "title": "VSETATTR",
  "url": "https://redis.io/docs/latest/commands/vsetattr/",
  "summary": "Associate or remove the JSON attributes of elements.",
  "since": "8.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-28T16:08:11+02:00",
  "page_type": "content",
  "content_hash": "843783f2de20ee28e5e54c83926b14656376b25519d212c170892da10fa16ec7",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "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`.\n\nYou can also update existing attributes or delete them by setting an empty string.\n\n[code example]\n\nTo remove attributes, pass an empty JSON string:\n\n[code example]"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open>\n<summary><code>key</code></summary>\n\nis the name of the key that holds the vector set.\n</details>\n\n<details open>\n<summary><code>element</code></summary>\n\nis the name of the element whose attributes you want to set or remove.\n</details>\n\n<details open>\n<summary><code>json</code></summary>\n\nis the JSON string with the attributes of the element. Use an empty string (`\"\"`) to delete the attributes.\nThe 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`.\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): 0 if either the key or element does not exist; 1 if the attributes were set or deleted.\n\n**RESP3:**\n\n[Boolean reply](../../develop/reference/protocol-spec#booleans): false if either the key or element does not exist; true if the attributes were set or deleted."
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "- [Vector sets](https://redis.io/docs/latest/develop/data-types/vector-sets)\n- [Filtered search](https://redis.io/docs/latest/develop/data-types/vector-sets/filtered-search)"
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "shell",
      "code": "VSETATTR key element \"{\\\"type\\\": \\\"fruit\\\", \\\"color\\\": \\\"red\\\"}\"",
      "section_id": "overview"
    },
    {
      "id": "overview-ex1",
      "language": "shell",
      "code": "VSETATTR key element \"\"",
      "section_id": "overview"
    }
  ]
}
