{
  "id": "cli",
  "title": "The RedisVL CLI",
  "url": "https://redis.io/docs/latest/develop/ai/redisvl/0.18.1/user_guide/cli/",
  "summary": "",
  "content": "\n\nRedisVL is a Python library with a dedicated CLI to create, inspect, list, and delete Redis search indexes, inspect index statistics, and run the RedisVL MCP server.\n\nThis notebook will walk through how to use the Redis Vector Library CLI (``rvl``).\n\nBefore running this notebook, be sure to\n1. Have installed ``redisvl`` and have that environment active for this notebook.\n2. Have a running Redis instance with Redis Search enabled\n\nFor complete command syntax and options, see the CLI Reference.\n\n\n```python\n# First, see if the rvl tool is installed\n!rvl version\n```\n\n## Commands\nThe table below documents the current CLI tree. Use ``rvl index --help`` and ``rvl stats --help`` for detailed flag help and examples.\n\n| Command | Purpose |\n|---------|---------|\n| `rvl version` | display the installed RedisVL version |\n| `rvl index create` | create a new Redis search index from a schema YAML file |\n| `rvl index info` | display schema and storage details for an index |\n| `rvl index listall` | list Redis search indexes available on the target Redis deployment |\n| `rvl index delete` | delete an index while leaving indexed data in Redis |\n| `rvl index destroy` | delete an index and drop its indexed data |\n| `rvl stats` | display statistics for an existing Redis search index |\n| `rvl mcp` | run the RedisVL MCP server |\n\nWithin data-plane commands, ``-i`` or ``--index`` targets an existing Redis index name and ``-s`` or ``--schema`` points to a schema YAML file. Shared Redis connection options such as ``--url``, ``--host``, and ``--port`` apply to ``rvl index`` and ``rvl stats``.\n\n## Index\n\nThe ``rvl index`` command groups the index management workflows. Use ``rvl index --help`` to see the documented subcommands: ``create``, ``info``, ``listall``, ``delete``, and ``destroy``. Whether you are working in Python or another language, this CLI can still be useful for managing and inspecting your indexes.\n\nFirst, we will create an index from a yaml schema that looks like the following:\n\n\n\n```python\n%%writefile schema.yaml\n\nversion: '0.1.0'\n\nindex:\n    name: vectorizers\n    prefix: doc\n    storage_type: hash\n\nfields:\n    - name: sentence\n      type: text\n    - name: embedding\n      type: vector\n      attrs:\n        dims: 768\n        algorithm: flat\n        distance_metric: cosine\n```\n\n    Overwriting schema.yaml\n\n\n\n```python\n# Create an index from a yaml schema\n!rvl index create -s schema.yaml\n```\n\n    Index created successfully\n\n\n\n```python\n# list the indices that are available\n!rvl index listall\n```\n\n    Indices:\n    1. vectorizers\n\n\n\n```python\n# inspect the index fields\n!rvl index info -i vectorizers\n```\n\n    \n    \n    Index Information:\n    ╭───────────────┬───────────────┬───────────────┬───────────────┬───────────────╮\n    │ Index Name    │ Storage Type  │ Prefixes      │ Index Options │ Indexing      │\n    ├───────────────┼───────────────┼───────────────┼───────────────┼───────────────┤\n    | vectorizers   | HASH          | ['doc']       | []            | 0             |\n    ╰───────────────┴───────────────┴───────────────┴───────────────┴───────────────╯\n    Index Fields:\n    ╭─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────┬─────────────────╮\n    │ Name            │ Attribute       │ Type            │ Field Option    │ Option Value    │ Field Option    │ Option Value    │ Field Option    │ Option Value    │ Field Option    │ Option Value    │\n    ├─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┼─────────────────┤\n    │ sentence        │ sentence        │ TEXT            │ WEIGHT          │ 1               │                 │                 │                 │                 │                 │                 │\n    │ embedding       │ embedding       │ VECTOR          │ algorithm       │ FLAT            │ data_type       │ FLOAT32         │ dim             │ 768             │ distance_metric │ COSINE          │\n    ╰─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────┴─────────────────╯\n\n\n\n```python\n# delete an index without deleting the data within it\n!rvl index delete -i vectorizers\n```\n\n    Index deleted successfully\n\n\n\n```python\n# see the indices that still exist\n!rvl index listall\n```\n\n    Indices:\n\n\n## Stats\n\nThe ``rvl stats`` command returns basic information about an index. Use ``-i`` or ``--index`` to target an existing Redis index name, or ``-s`` or ``--schema`` to target a schema-defined index. Shared Redis connection options such as ``--url``, ``--host``, and ``--port`` also apply here.\n\n\n```python\n# create a new index with the same schema\n# recreating the index will reindex the documents\n!rvl index create -s schema.yaml\n```\n\n    Index created successfully\n\n\n\n```python\n# list the indices that are available\n!rvl index listall\n```\n\n    Indices:\n    1. vectorizers\n\n\n\n```python\n# see all the stats for the index\n!rvl stats -i vectorizers\n```\n\n    \n    Statistics:\n    ╭─────────────────────────────┬────────────╮\n    │ Stat Key                    │ Value      │\n    ├─────────────────────────────┼────────────┤\n    │ num_docs                    │ 0          │\n    │ num_terms                   │ 0          │\n    │ max_doc_id                  │ 0          │\n    │ num_records                 │ 0          │\n    │ percent_indexed             │ 1          │\n    │ hash_indexing_failures      │ 0          │\n    │ number_of_uses              │ 1          │\n    │ bytes_per_record_avg        │ nan        │\n    │ doc_table_size_mb           │ 0.00769805 │\n    │ inverted_sz_mb              │ 0          │\n    │ key_table_size_mb           │ 2.28881835 │\n    │ offset_bits_per_record_avg  │ nan        │\n    │ offset_vectors_sz_mb        │ 0          │\n    │ offsets_per_term_avg        │ nan        │\n    │ records_per_doc_avg         │ nan        │\n    │ sortable_values_size_mb     │ 0          │\n    │ total_indexing_time         │ 0          │\n    │ total_inverted_index_blocks │ 0          │\n    │ vector_index_sz_mb          │ 0          │\n    ╰─────────────────────────────┴────────────╯\n\n\n## Optional arguments\nYou can modify these commands with the below optional arguments\n\n| Argument       | Description | Default |\n|----------------|-------------|---------|\n| `-u --url`     | The full Redis URL to connect to | `redis://localhost:6379` |\n| `--host`       | Redis host to connect to | `localhost` |\n| `-p --port`    | Redis port to connect to. Must be an integer | `6379` |\n| `--user`       | Redis username, if one is required   | `default` |\n| `--ssl`        | Boolean flag indicating if ssl is required. If set the Redis base url changes to `rediss://` | None |\n| `-a --password`| Redis password, if one is required| `\"\"` |\n\n### Choosing your Redis instance\nBy default rvl first checks if you have `REDIS_URL` environment variable defined and tries to connect to that. If not, it then falls back to `localhost:6379`, unless you pass the `--host` or `--port` arguments\n\n\n```python\n# specify your Redis instance to connect to\n!rvl index listall --host localhost --port 6379\n```\n\n    Indices:\n    1. vectorizers\n\n\n### Using SSL encryption\nIf your Redis instance is configured to use SSL encryption then set the `--ssl` flag.\nYou can similarly specify the username and password to construct the full Redis URL\n\n\n```python\n# NBVAL_SKIP\n# Not run in CI. This cell would block until the nbval cell timeout\n# connect to rediss://jane_doe:password123@localhost:6379\n!rvl index listall --user jane_doe -a password123 --ssl\n```\n\n\n```python\n!rvl index destroy -i vectorizers\n```\n\n    Index deleted successfully\n\n",
  "tags": [],
  "last_updated": "2026-05-14T08:58:05-05:00"
}
