Manage vector indexes
Choose index settings, create and inspect an index, maintain it and remove it.
Skeg 0.8 · Development documentation
Create an index before loading vectors. Use this guide to choose its settings, verify what was created and decide when to consolidate or replace it.
The exercise uses Skeg 0.8, redis-cli and a fresh local store. In one
terminal, start the server on port 6385:
data_dir=$(mktemp -d) &&
skeg --protocol resp3 --data-dir "$data_dir" --addr 127.0.0.1:6385
In another terminal, open the client. Enter the Skeg commands below at its prompt.
redis-cli -3 -h 127.0.0.1 -p 6385
On a shared server, sign in first. Index names refer to the tenant on the current connection.
Choose settings before loading data
| Setting | What to choose |
|---|---|
| Name | A name the application uses to identify this index. See index names. |
| Dimension | The number of coordinates produced by your embedding model. |
| Kind | The vector representation, such as tq2 or int8. Check the server’s dimension rules for the chosen kind. |
| Backend and persistence | Use disk and durable for an index that survives a restart. Use flat and ephemeral for a temporary index. |
| Default search effort | For a disk index, L sets the graph effort used by requests that pass l_search=0. |
Keep the model revision and preprocessing settings with the application.
Queries and stored vectors must use the same embedding space. Use
SKEG.CAPABILITIES to inspect the available kinds and limits. See the
creation reference for
supported combinations and defaults.
Create a durable index
Create a disk index with four dimensions and an explicit default effort. Use the dimension of your model outside this exercise.
SKEG.VINDEX.CREATE article_index_demo 4 KIND tq2 BACKEND disk PERSISTENCE durable L 100
Expect OK. The index starts empty. Repeating the same create gives
ERR [EXISTS]. For application startup code that may run again, use
IFNOTEXISTS to check for the same configuration:
SKEG.VINDEX.CREATE article_index_demo 4 KIND tq2 BACKEND disk PERSISTENCE durable L 100 IFNOTEXISTS
Expect OK when dimension, kind, backend, persistence and default effort
match. If they differ, Skeg reports the differing setting and leaves the
index unchanged. Use SKEG.VINDEX.INFO before deciding how to proceed.
Create a temporary index
Specify both BACKEND flat and PERSISTENCE ephemeral:
SKEG.VINDEX.CREATE temporary_index_demo 4 KIND tq2 BACKEND flat PERSISTENCE ephemeral
Expect OK. A writable restart removes the temporary index. Any
separate KV records created by the application follow their own lifetime.
Inspect an index
List indexes visible to the current tenant, then read the durable index’s configuration:
SKEG.VINDEX.LIST
SKEG.VINDEX.INFO article_index_demo
LIST returns a text listing. In the INFO response, check dim, kind,
backend, persistence and l against the request. On this new store,
count is zero until you write rows.
Save incarnation if the application needs to identify this index across
restarts. Dropping and recreating the same name gives it a new incarnation.
If the field changes, refresh cached information tied to the old index.
Use sample_coverage and sample_incomplete when interpreting sampled
payload fields.
Load and maintain the index
Write rows with SKEG.VSET or follow batch ingestion.
Disk indexes can serve queries with pending delta data. After a load,
use the index’s health and shard reports
to decide whether to consolidate.
SKEG.VINDEX.CONSOLIDATE article_index_demo
The command requests a fold across the disk index’s shards. Expect OK
when the work succeeds or there is nothing to fold. A flat index has no
fold work. If a shard fails, check the reported outcome and the index
state. Other shards may already have completed work, and earlier writes
remain separate operations. For BACKPRESSURE, see
write outcomes and
memory and maintenance.
Replace the index configuration
To use a new dimension, kind or embedding model, create an index with a new name and load it from the application source. Compare results on representative queries. Account for writes made during the load before switching the application to the new index. Keep the old index until it is safe to discard.
Drop the example indexes
After the checks, stop any writes to these example indexes and drop them:
SKEG.VINDEX.DROP article_index_demo
SKEG.VINDEX.DROP temporary_index_demo
The drop removes the vector rows and their payloads. Independent KV records remain. If a drop reply is lost, inspect the current index and its incarnation before retrying. Another process may have reused the name.
Exit the client, then stop the exercise server with Ctrl+C. Remove the temporary data directory after shutdown if you no longer need it.