redis-vl-dotnet
IndexDefinition
IndexDefinition describes the Redis index-level settings that sit above individual fields.
Required settings
The minimum definition is:
var indexDefinition = new IndexDefinition(
name: "movies-idx",
prefix: "movie:",
storageType: StorageType.Json);
Required values:
-
name: the RediSearch index name -
prefixorprefixes: one or more Redis key prefixes to include in the index -
storageType:StorageType.JsonorStorageType.Hash
Prefixes and key separator
Use a single prefix for the common case, or multiple prefixes when the same schema should cover several key families:
var indexDefinition = new IndexDefinition(
"movies-idx",
["movie:", "movie-archive:"],
StorageType.Json,
keySeparator: '|');
Behavior to keep in mind:
-
prefixes cannot be blank
-
at least one prefix is required
-
KeySeparatormust be a single non-whitespace character -
Prefixreturns the first configured prefix and remains the default prefix used by key-resolution helpers
Advanced index options
The library exposes these index-level options from the constructor and YAML loader:
| Option | Purpose |
|---|---|
|
Sets stopwords for the index. Use an empty list in YAML to disable them. |
|
Enables the RediSearch |
|
Creates a temporary index when greater than zero. |
|
Disables term offset storage. |
|
Disables highlight support metadata. |
|
Disables field bitmaps in the index. |
|
Disables term frequency storage. |
|
Skips the initial prefix scan during index creation. |
These options are all supported by SearchSchema.FromYaml as well, so a YAML schema can fully describe the same index metadata as a typed definition.
Storage choice
storageType determines which Redis data model backs the index:
-
StorageType.Jsonfor RedisJSON documents -
StorageType.Hashfor Redis hashes
That one value also controls which SearchIndex document APIs are valid later. Keep the storage type and your load/fetch/update calls aligned.
Example reference
/examples/JsonStorageExample/schema.yaml shows a JSON-backed definition with multiple prefixes, a custom key separator, disabled stopwords, and several advanced options enabled.
Use /examples/VectorSearchExample for the smaller HASH-backed constructor-based version.