SKEG · REFERENCE

Vector commands and capabilities

Look up creation options, search responses and features advertised by a server.

Skeg 0.8 · Development documentation

Look up the arguments and replies for Skeg vector commands over RESP. See index management for a worked example or write outcomes for retry and recovery.

TaskCommands
Create or remove an indexVINDEX.CREATE, VINDEX.DROP
Find an index or inspect its configurationVINDEX.LIST, VINDEX.INFO
Write, read or delete a rowVSET, VGET, VDEL
Write several rowsVMSET
Run a nearest-neighbour queryVSEARCH
Inspect or consolidate an indexVINDEX.SHARDS, HEALTH, CHECK, VINDEX.CONSOLIDATE
Discover features and limitsCAPABILITIES

Command reference

Index names

Use ASCII letters, digits, ., _ and -. Names cannot be empty or contain ... The maximum stored name is 240 bytes, including the tenant prefix. Read limits.index_name_max_bytes for the space available to the caller.

Skeg refuses a name beyond this limit rather than shortening it. Conversion from a legacy store reports an incomplete conversion for an index whose name cannot fit, including legacy names of 241–248 bytes.

Create an index

SKEG.VINDEX.CREATE <name> <dim> [KIND <kind>] BACKEND flat|disk
                   [PERSISTENCE ephemeral|durable] [L <n>] [IFNOTEXISTS]

The positional form, SKEG.VINDEX.CREATE <name> <dim> [<kind>] disk, creates a durable disk index. Both forms default to tq2 when the kind is omitted.

Backend and persistence

BackendPersistenceBehaviour
diskdurable or omittedStores a persistent Disk/Vamana index.
flatephemeralCreates a temporary in-memory search index.
diskephemeralRefused.
flatdurable or omittedRefused.

The kind determines which backends accept the index and which dimensions are valid. The dimension must be positive, within limits.max_dim, and divisible by the value in the last column.

KindBackendsDimension multiple
f32, binaryflat1
int8flat, disk1
tq1flat, disk8
tq2flat, disk4
tq4flat, disk2

For example, create a temporary flat index for 768-dimensional vectors:

SKEG.VINDEX.CREATE articles 768 KIND f32 BACKEND flat PERSISTENCE ephemeral

L applies to disk indexes. It defaults to 100 and accepts values from 1 through limits.max_l. A search with l_search=0 uses that default. A nonzero search effort overrides it for the query. See choosing search effort.

IFNOTEXISTS returns OK for an existing index whose dimension, kind, backend, persistence and L match the request. A mismatch returns an error naming the field; the option does not change an existing index’s settings.

Inspect an index

SKEG.VINDEX.LIST
SKEG.VINDEX.INFO <name>

LIST returns a text bulk string with one line per visible index. An empty listing is an empty string. Names are relative to the authenticated tenant’s namespace. Operational counts in a listing are not a complete inventory of application documents.

INFO returns a RESP3 map, or a flat array of key/value pairs on RESP2. An unknown index returns an error. A registered but unreadable or incomplete index is a storage error rather than an empty index or a missing one.

The response includes the index’s backend, persistence and incarnation. The incarnation identifies this creation of the index: it survives flush, consolidation, restart and eviction, but changes after a drop and re-creation. It is null for older stores without recorded identities. Use it when a client needs to distinguish a cached index from a new index with the same name. A creation timestamp alone cannot distinguish two creates in one millisecond.

Configuration fields include dim, kind, backend, persistence and l. The count field is the vector count. graph_backing and codes_backing report where this index keeps those structures. Use process metrics for total RSS. Read sample_coverage, sample_incomplete and the truncation indicators when interpreting sampled payload_fields.

Inspect index health

SKEG.VINDEX.SHARDS <name>
SKEG.HEALTH <name>
SKEG.CHECK <name>

All three address an index in the caller’s tenant namespace and return a text bulk string. They are inspection commands, not repair requests.

CommandPurposeHow to read the response
VINDEX.SHARDSInspect per-shard LSM stateRead live rows, delta, runs and debt per shard. A shard without the index can be reported with absent=1.
HEALTHAssess maintenance backlog and index coverageRead the state and accompanying details. UNASSESSED or PARTIAL does not mean zero backlog or full coverage.
CHECKInspect index consistencyA report with no detected problems is the text OK\n; otherwise read each reported problem.

The RESP reply’s success does not by itself mean the index is healthy: a problem report is still a returned bulk string. Unknown, unreadable or incomplete states require investigation. A consistency check cannot certify application document completeness, semantic relevance or backup recoverability. See monitoring for how to combine these reports with metrics and logs.

Write, read and delete rows

SKEG.VSET <name> <id> <vector> [PAYLOAD <blob>]
SKEG.VGET <name> <id> [WITHPAYLOAD]
SKEG.VDEL <name> <id>

An ID is a decimal unsigned 64-bit integer. Vector arguments contain exactly dim × 4 bytes, with one little-endian float32 per coordinate. Use the same encoding for every kind, including binary.

VSET creates or replaces the row and returns OK. Omit PAYLOAD to keep an existing payload. Supply PAYLOAD to replace the entire payload, using an empty bulk string to store an empty payload. The server advertises the per-item limit in limits.payload_max_bytes.

VGET returns the stored vector bytes, or null for a missing row. When the server advertises vget.withpayload, WITHPAYLOAD returns [vector, payload, version, incarnation] from one observation on RESP2 and RESP3. The payload is null when absent and an empty bulk string when stored empty. The version is a decimal unsigned integer encoded as a bulk string. For a missing row, the first three fields are null. The incarnation is the 32-digit hexadecimal identifier from VINDEX.INFO, or null for an older index without a recorded identity.

VDEL returns 1 for a removed live row and 0 when no live row was removed.

Follow update and delete an article for a worked example of coordinating vector rows with application records.

Drop an index

SKEG.VINDEX.DROP <name>

A successful drop returns OK. Manage independent application keys separately. A later create with the same name has a new incarnation.

Write a batch

SKEG.VMSET <name> <id> <vector> <payload> [<id> <vector> <payload> ...]

Arguments. One or more triples; the payload field is required. Each vector uses the same little-endian float32 encoding as VSET. An empty payload field leaves a new row without a payload and preserves the current payload when replacing an existing row. To store an empty payload or clear its previous contents, use VSET ... PAYLOAD with an empty blob.

Limits. In 0.8, at most 4096 items, 64 MiB of vector bytes across the batch and 1 MiB for any one payload. Read the corresponding fields under limits for the connected server. Additional RESP and memory-admission limits apply. Size and structural checks occur before item dispatch; dimension, finite-coordinate and item-admission checks can fail per item.

Response. An array of exactly one result per input item, in request order. Each entry is simple-string OK or a RESP error. Clients can represent nested errors as objects inside the result array instead of raising one exception. Item error descriptions are bounded and can be truncated; do not use their full prose as a stable application interface.

Atomicity and concurrency. Items are independently applied and may run concurrently. There is no batch rollback. Avoid repeated IDs within a batch; reply order is not an ordering guarantee for writes to the same ID. Only a new live ID consumes another logical vector-quota slot.

Failure handling. A complete item success remains a success when a sibling fails. A top-level validation refusal is different from losing the reply after dispatch. Follow batch ingestion for a complete partial-failure example and write outcomes for retry and reconciliation rules. Read-only serving refuses this mutation.

Consolidate an index

SKEG.VINDEX.CONSOLIDATE <name>

Purpose. Fold disk-index delta/run data into the graph. The operation is a no-op for flat indexes and returns OK when the requested work succeeds or is not needed. Read-only serving refuses it.

Failures. An unknown or unreadable index returns an error. A maintenance memory refusal returns BACKPRESSURE. The command spans shards, so a failure does not establish that every shard remained unchanged. A failed consolidation does not roll back previously ingested rows. Handle it as maintenance, separately from the outcome of the writes that preceded it.

SKEG.VSEARCH <name> <k> <l_search> <query>
             [WITHPAYLOAD] [FILTER <expr>] [EXPLAIN]

k is the maximum number of results. l_search controls graph-search effort, and filters can select another query plan. The server clamps the arguments to limits.max_k and limits.max_l. Query vectors use the same byte format and dimension as stored vectors.

Payloads containing key=value fields can be filtered with =, IN (...), >=, >, <=, <, BETWEEN a AND b, EXISTS, and boolean AND, OR, NOT with parentheses. See the filter reference for types, complete grammar and which rows NOT can match, or payloads and filters for an example.

EXPLAIN adds a human-readable query profile. Its wording is not a stable interface; use it to investigate a query rather than as an application response schema. See observability.

Result formats

OptionsReply
DefaultFlat array [id, score, id, score, ...]
WITHPAYLOADFlat array [id, score, payload, id, score, payload, ...]
EXPLAINArray [hits, profile_text]. The first element keeps the requested pair or triple format.

Each ID is a decimal bulk string. Scores are RESP3 doubles or decimal bulk strings on RESP2. A missing payload is null. A stored empty payload is an empty bulk string. If the query finds no hits, the hit array is empty.

Temporary index files

Ephemeral indexes may use per-shard scratch/ files while the process runs. The next writable open discards the temporary indexes and attempts to remove that scratch directory, including after an unclean exit. A read-only open does not remove it.

If scratch cleanup fails, the store can still open, but obsolete files remain on disk. skeg_scratch_not_removed_at_open_total records the failure. Payload snapshot failures can also increase skeg_payload_index_write_failures_total and keep more data resident. Check permissions and reclaim obsolete scratch files while the writer is stopped; do not delete files from an active store.

Server capabilities

Ask the server which commands, kinds and limits it advertises:

SKEG.CAPABILITIES

The response is a RESP3 map, or a flat array of pairs on RESP2. HELLO 3 also includes this map under skeg; HELLO 2 does not. On a strict server, authenticate before requesting capabilities.

FieldMeaning
server, versionServer name and version.
wire, resp_versionsTransport and supported RESP versions. Read proto in HELLO for the connection’s negotiated version.
kinds, kind_constraints, create_default_kindKinds in wire order, each kind’s dim_multiple, and the kind used when creation omits KIND.
backends, persistenceBackend and persistence options. Use the compatibility table to choose a supported combination.
featuresFeature names advertised by the build.
limitsDimension, search, batch, payload and name limits.
access_moderead-write or read-only. Read-only mode refuses mutations.
authsupported indicates a tenant backend is configured. required indicates strict mode.
memory_profile, graph_placement, codes_placementProcess profile and requested disk-index placement. Inspect the index itself with VINDEX.INFO for its current backing.
Limit fieldEffect
max_dimMaximum accepted vector dimension.
max_k, max_lSearch clamps arguments to these values. Creation rejects an L above max_l.
vmset_max_items, vmset_max_vector_bytesMaximum batch item count and total bytes of vector arguments.
payload_max_bytesMaximum payload size for one VSET or VMSET item.
index_name_max_bytesMaximum name length available in the caller’s tenant.

Read capabilities in a client

Check the relevant entry in features before using an optional argument. For VGET ... WITHPAYLOAD, check vget.withpayload. The search features are vsearch.withpayload, vsearch.filter and vsearch.explain. The index features are vindex.info, vindex.create.keywords, vindex.create.persistence, vindex.create.l and vindex.create.ifnotexists. Use access_mode to determine whether the process accepts mutations and auth to determine the login policy.

During the 0.8.x series, existing keys keep their types and meanings. New keys, feature names and limit entries can be added. Clients should ignore unknown fields and avoid depending on array order, except for the advertised wire order of kinds.

Limit values can change between releases. Read them from the connected server instead of treating a value from this manual as permanent. Capability lookup does not inspect the store or check its health.