{
  "id": "redis-writing-to-multiple-keys",
  "title": "Writing to multiple keys",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/transform-examples/redis-writing-to-multiple-keys/",
  "summary": "",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "66542191445845ffd9f0c3c51b2ea6f2afb5c3071e32a398af8ac8c26c86929c",
  "sections": [
    {
      "id": "content",
      "title": "Content",
      "role": "content",
      "text": "If you want to write results to multiple keys, you can do so by defining multiple `redis.write` subsections in the `output` section of the job file. Each instance of `redis.write` can specify a different key, data format, and other parameters. For example, you can create two different keys for the same data, one with a default key format and another with a custom key format and mapping.\n\n[code example]"
    }
  ],
  "examples": [
    {
      "id": "content-ex0",
      "language": "yaml",
      "code": "name: Write to multiple keys with different formats\noutput:\n  - uses: redis.write\n    with:\n      # Setting data_type to JSON and using the default key format\n      data_type: json\n\n  - uses: redis.write\n    with:\n      data_type: json\n\n      # Defining a custom key format\n      key:\n        language: jmespath\n        expression: concat(['events-simplified:id:', id])\n\n      # And defining a custom mapping\n      mapping:\n        - id: id\n        - name: name\n        - location: location",
      "section_id": "content"
    }
  ]
}
