redis-vl-dotnet
CLI
This section is the canonical guide for the redis-vl-dotnet command-line workflows. Use it when you want to validate schemas, inspect existing indexes, and create or remove indexes from a terminal session.
Build and install
Build the CLI project from the repository root:
dotnet build src/RedisVL.Cli/RedisVL.Cli.csproj
Run commands directly from source during local development:
dotnet run --project src/RedisVL.Cli -- --help
If you want a reusable local executable, publish the CLI into a local folder and invoke the generated RedisVL.Cli.dll with dotnet:
dotnet publish src/RedisVL.Cli/RedisVL.Cli.csproj -c Release -o .artifacts/redisvl-cli
dotnet .artifacts/redisvl-cli/RedisVL.Cli.dll --help
Discover commands
The CLI has two command groups:
-
indexfor index lifecycle commands such aslist,info,create,clear, anddelete -
schemafor offline schema file commands such asvalidateandshow
Show the top-level command tree:
dotnet run --project src/RedisVL.Cli -- --help
Inspect a command group before running it:
dotnet run --project src/RedisVL.Cli -- index --help
dotnet run --project src/RedisVL.Cli -- schema --help
Connection arguments
All index commands need a Redis connection string. Pass it explicitly with --redis:
dotnet run --project src/RedisVL.Cli -- index list --redis localhost:6379
Or set REDIS_VL_REDIS_URL once for the shell session and let the CLI reuse it:
export REDIS_VL_REDIS_URL=localhost:6379
dotnet run --project src/RedisVL.Cli -- index list
When neither --redis nor REDIS_VL_REDIS_URL is set, the CLI exits with an error before connecting.
Schema workflows
Validate a YAML schema file before using it to create an index:
dotnet run --project src/RedisVL.Cli -- schema validate \
--file examples/JsonStorageExample/schema.yaml
Show the parsed schema as JSON when you want to inspect the normalized index and field definitions:
dotnet run --project src/RedisVL.Cli -- schema show \
--file examples/JsonStorageExample/schema.yaml
These commands do not contact Redis. They only load and parse the YAML file on disk.
Index lifecycle workflows
List the current RediSearch indexes:
dotnet run --project src/RedisVL.Cli -- index list --redis localhost:6379
Inspect one index and print the discovered schema plus scalar FT.INFO attributes as JSON:
dotnet run --project src/RedisVL.Cli -- index info \
--redis localhost:6379 \
--name movies-cli-idx
Create an index from a YAML schema file:
dotnet run --project src/RedisVL.Cli -- index create \
--redis localhost:6379 \
--schema examples/JsonStorageExample/schema.yaml
Create an index inline when you want a quick HASH- or JSON-backed shape without a separate schema file:
dotnet run --project src/RedisVL.Cli -- index create \
--redis localhost:6379 \
--name movies-cli-idx \
--prefix movie: \
--storage hash \
--field text:title \
--field tag:genre \
--field numeric:year
The inline --field syntax supports text, tag, numeric, and geo. Repeat --prefix or --field when you need more than one entry.
Use the create flags to control existing indexes:
-
--skip-if-existsreturns success without replacing an existing index -
--overwritedrops the existing index definition first -
--drop-documentsonly applies together with--overwriteand removes indexed documents too
Clear documents from an index while keeping the index definition:
dotnet run --project src/RedisVL.Cli -- index clear \
--redis localhost:6379 \
--name movies-cli-idx \
--batch-size 500
Delete an index definition:
dotnet run --project src/RedisVL.Cli -- index delete \
--redis localhost:6379 \
--name movies-cli-idx
Delete the index and the indexed documents in one step:
dotnet run --project src/RedisVL.Cli -- index delete \
--redis localhost:6379 \
--name movies-cli-idx \
--drop-documents
Troubleshooting
Connection failures usually fall into one of these cases:
-
The '--redis' option is required when REDIS_VL_REDIS_URL is not set.means no connection string was provided by flag or environment variable. -
It was not possible to connect…from StackExchange.Redis usually means Redis is not reachable on the host or port you passed. Recheck the container, local service, firewall, or forwarded port. -
Authentication or TLS errors come from the connection string itself; use the same endpoint, password, and SSL parameters that work for your application code.
Module-related failures typically show up during index commands:
-
Errors mentioning
FT._LIST,FT.INFO, orFT.CREATEusually mean Redis Search is not available on the target server. -
JSON-backed schemas also need RedisJSON support. If you create a JSON index against a server without RedisJSON, use Redis Stack locally or switch the schema to HASH storage.
-
schema validateandschema showcan still succeed against an environment that cannot run the index commands, because those schema commands only parse YAML locally.
Related sections
-
Core Features for the underlying schema and index model
-
Examples for runnable feature-area samples that pair with CLI-managed indexes
-
Testing for CLI-focused test coverage