Upstash Documentation

HGETALL

Get all fields and values.
2 min read

Use HGETALL to read every field and value of a hash in one call.

The reply pairs each field with its value. RESP2 flattens it into a single alternating array while RESP3 returns a map, and client libraries normally decode either form into a native dictionary. A missing key returns an empty result rather than an error.

The whole hash is transferred, so on hashes with many fields prefer HMGET when you know which fields you need, or HSCAN to walk the hash in batches.

Syntax#

Arguments#

ArgumentRequiredRepeatableDescription
<key>YesNoRedis key targeted by the command.

Important points#

  • Pair-based results may be flattened into one alternating array in RESP2 while RESP3 preserves nested pairs or a map.

Response#

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.

ProtocolReply
RESP2Flat array of alternating keys and values
RESP3Map
Note

Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples#

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Redis CLI
@upstash/redis
upstash_redis
ioredis
node-redis
redis-py
go-redis
jedis
redis-rs