{
  "id": "arop",
  "title": "AROP",
  "url": "https://redis.io/docs/latest/commands/arop/",
  "summary": "Performs aggregate operations on array elements in a range.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-05-25T10:30:01-07:00",
  "page_type": "content",
  "content_hash": "57256d62e5d025d59560f6e01cfaf5e7ce0e9cb6fdd11a1e4cd4c855224be3d1",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Performs aggregate operations on array elements in a range."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the array.\n\n</details>\n\n<details open><summary><code>start</code></summary>\n\nThe zero-based integer index of the first element in the range to aggregate.\n\n</details>\n\n<details open><summary><code>end</code></summary>\n\nThe zero-based integer index of the last element in the range to aggregate (inclusive). The command always scans from the lower to the higher index regardless of argument order.\n\n</details>\n\n<details open><summary><code>operation</code></summary>\n\nThe aggregate function to apply to all non-empty elements in `[start, end]`. One of:\n\n- **`SUM`** — Returns the sum of all numeric values as a bulk string.\n- **`MIN`** — Returns the minimum numeric value as a bulk string.\n- **`MAX`** — Returns the maximum numeric value as a bulk string.\n- **`AND`** — Returns the bitwise AND of all values, treating each as an integer (floats are truncated toward zero).\n- **`OR`** — Returns the bitwise OR of all values, treating each as an integer (floats are truncated toward zero).\n- **`XOR`** — Returns the bitwise XOR of all values, treating each as an integer (floats are truncated toward zero).\n- **`MATCH value`** — Returns the count of elements whose value equals `value` as an integer reply.\n- **`USED`** — Returns the count of non-empty elements in the range as an integer reply.\n\n`SUM`, `MIN`, and `MAX` return nil when no numeric elements are present in the range. `AND`, `OR`, and `XOR` return nil when the range is empty.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "ARMSET myarray 0 \"10\" 1 \"20\" 2 \"30\"\nAROP myarray 0 2 SUM\nAROP myarray 0 2 MIN\nAROP myarray 0 2 MAX\nAROP myarray 0 2 MATCH \"10\"\nAROP myarray 0 2 USED\nARMSET flags 0 \"255\" 1 \"15\" 2 \"240\"\nAROP flags 0 2 AND\nAROP flags 0 2 OR"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n* [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): Result of the operation.\n* [Integer reply](../../develop/reference/protocol-spec#integers): Integer result for MATCH, USED, AND, OR, XOR.\n* [Nil reply](../../develop/reference/protocol-spec#null-bulk-strings): Null if no elements match the operation.\n\n**RESP3:**\n\nOne of the following:\n* [Bulk string reply](../../develop/reference/protocol-spec#bulk-strings): Result of the operation.\n* [Integer reply](../../develop/reference/protocol-spec#integers): Integer result for MATCH, USED, AND, OR, XOR.\n* [Null reply](../../develop/reference/protocol-spec#nulls): Null if no elements match the operation."
    }
  ],
  "examples": []
}
