{
  "id": "himport-set",
  "title": "HIMPORT SET",
  "url": "https://redis.io/docs/latest/commands/himport-set/",
  "summary": "Creates a fieldset-based hash from values supplied in the order matching a previously prepared fieldset.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-07-30T08:54:30-07:00",
  "page_type": "content",
  "content_hash": "88a6e4f81cc86e556b8039cf0b47eb4f4a48dd501ed62a07cf69bab1dbd13e57",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Creates a hash from a fieldset previously defined with [`HIMPORT PREPARE`](https://redis.io/docs/latest/commands/himport-prepare), pairing the fieldset's field names with the supplied values by position."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe key to create. If the key already exists, it is overwritten.\n\n</details>\n\n<details open><summary><code>fieldset-name</code></summary>\n\nThe name of a fieldset previously defined with [`HIMPORT PREPARE`](https://redis.io/docs/latest/commands/himport-prepare) on the same connection.\n\n</details>\n\n<details open><summary><code>value [value ...]</code></summary>\n\nThe field values, given in the same order as the field names were declared in the fieldset. The number of values must equal the number of fields in the fieldset.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "details",
      "title": "Details",
      "role": "content",
      "text": "`HIMPORT SET` creates or overwrites `key` as a hash whose fields are the field names of the prepared fieldset, each paired with the value at the same position. The number of values must match the number of fields in the fieldset.\n\nThe command returns an error if the fieldset has not been prepared on the current connection, or if the number of values does not match the fieldset's field count.\n\nKeys created this way behave exactly like any other hash and work with all existing hash commands. Because they share a fixed set of field names, Redis can store them as [compact hashes](https://redis.io/docs/latest/develop/data-types/hashes#compact-hashes), keeping a single copy of the field names to reduce memory when many keys share the same layout."
    },
    {
      "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=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; 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[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`.\n\n**RESP3:**\n\n[Simple string reply](../../develop/reference/protocol-spec#simple-strings): `OK`."
    },
    {
      "id": "see-also",
      "title": "See also",
      "role": "related",
      "text": "[`HIMPORT PREPARE`](https://redis.io/docs/latest/commands/himport-prepare/) | [`HSET`](https://redis.io/docs/latest/commands/hset/) | [`HIMPORT DISCARD`](https://redis.io/docs/latest/commands/himport-discard/)"
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "> HIMPORT PREPARE u name email age\nOK\n> HIMPORT SET user:1 u alice a@example.com 30\nOK\n> HIMPORT SET user:2 u bob b@example.com 25\nOK\n> HGET user:1 name\n\"alice\"\n> HGET user:1 email\n\"a@example.com\"\n> HGET user:1 age\n\"30\"",
      "section_id": "examples"
    }
  ]
}
