{
  "schema_version": 2,
  "id": "commands/ft.explain",
  "title": "FT.EXPLAIN",
  "url": "https://redis.io/docs/latest/commands/ft.explain/",
  "summary": "Returns the execution plan for a complex query",
  "since": "1.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:47:58+01:00",
  "page_type": "content",
  "content_hash": "de63563d47b842f14989cbbd054854e03b919542822608ea8fd9a832888b0753",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Return the execution plan for a complex query\n\n[Examples](#examples)"
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open>\n<summary><code>index</code></summary>\n\nis index name. You must first create the index using [`FT.CREATE`](https://redis.io/docs/latest/commands/ft.create).\n</details>\n\n<details open>\n<summary><code>query</code></summary>\n\nis query string, as if sent to FT.SEARCH`.\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open>\n<summary><code>DIALECT {dialect_version}</code></summary>\n\nis dialect version under which to execute the query. If not specified, the query executes under the default dialect version set during module initial loading or via [`FT.CONFIG SET`](https://redis.io/docs/latest/commands/ft.config-set) command.\n</details>\n\n> [!NOTE] Notes\n>  \n> - In the returned response, a `+` on a term is an indication of stemming.\n> - Use `redis-cli --raw` to properly read line-breaks in the returned response."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "<details open>\n<summary><b>Return the execution plan for a complex query</b></summary>\n\n\n$ redis-cli --raw\n\n127.0.0.1:6379> FT.EXPLAIN rd \"(foo bar)|(hello world) @date:[100 200]|@date:[500 +inf]\"\nINTERSECT {\n  UNION {\n    INTERSECT {\n      foo\n      bar\n    }\n    INTERSECT {\n      hello\n      world\n    }\n  }\n  UNION {\n    NUMERIC {100.000000 <= x <= 200.000000}\n    NUMERIC {500.000000 <= x <= inf}\n  }\n}\n\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis Cloud<br />Flexible & Annual | Redis Cloud<br />Free & Fixed | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span> | <span title=\"Supported\">&#x2705; Supported</span> | <span title=\"Supported\">&#x2705; Supported</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n* [Bulk string](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) containing the query execution plan.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: no such index, syntax error in query.\n\n**RESP3:**\n\nOne of the following:\n* [Bulk string](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) containing the query execution plan.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: no such index, syntax error in query."
    },
    {
      "id": "see-also",
      "title": "See also",
      "role": "related",
      "text": "[`FT.CREATE`](https://redis.io/docs/latest/commands/ft.create) | [`FT.SEARCH`](https://redis.io/docs/latest/commands/ft.search) | [`FT.CONFIG SET`](https://redis.io/docs/latest/commands/ft.config-set)"
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "[RediSearch](https://redis.io/docs/latest/develop/ai/search-and-query)"
    }
  ],
  "examples": []
}
