Command Reference
Global Options
Every command accepts these options:
| Option | Environment Variable | Default | Description |
|---|---|---|---|
--data-dir <PATH> | LAURUS_DATA_DIR | ./laurus_data | Path to the index data directory |
--format <FORMAT> | — | table | Output format: table or json |
# Example: use JSON output with a custom data directory
laurus --data-dir /var/data/my_index --format json search "title:rust"
create — Create a Resource
create index
Create a new index from a schema TOML file.
laurus create index --schema <FILE>
Arguments:
| Flag | Required | Description |
|---|---|---|
--schema <FILE> | Yes | Path to a TOML file defining the index schema |
Schema file format:
The schema file follows the same structure as the Schema type in the Laurus library. See Schema Format Reference for full details. Example:
default_fields = ["title", "body"]
[fields.title.Text]
stored = true
indexed = true
[fields.body.Text]
stored = true
indexed = true
[fields.category.Text]
stored = true
indexed = true
Example:
laurus --data-dir ./my_index create index --schema schema.toml
# Index created at ./my_index.
Note: An error is returned if the index already exists. Delete the data directory to recreate.
create schema
Interactively generate a schema TOML file through a guided wizard.
laurus create schema [--output <FILE>]
Arguments:
| Flag | Required | Default | Description |
|---|---|---|---|
--output <FILE> | No | schema.toml | Output file path for the generated schema |
The wizard guides you through:
- Field definition — Enter a field name, select the type, and configure type-specific options
- Repeat — Add as many fields as needed
- Default fields — Select which lexical fields to use as default search fields
- Preview — Review the generated TOML before saving
- Save — Write the schema file
Supported field types:
| Type | Category | Options |
|---|---|---|
Text | Lexical | indexed, stored, term_vectors |
Integer | Lexical | indexed, stored |
Float | Lexical | indexed, stored |
Boolean | Lexical | indexed, stored |
DateTime | Lexical | indexed, stored |
Geo | Lexical | indexed, stored |
Bytes | Lexical | stored |
Hnsw | Vector | dimension, distance, m, ef_construction |
Flat | Vector | dimension, distance |
Ivf | Vector | dimension, distance, n_clusters, n_probe |
Example:
# Generate schema.toml interactively
laurus create schema
# Specify output path
laurus create schema --output my_schema.toml
# Then create an index from the generated schema
laurus create index --schema schema.toml
get — Get a Resource
get index
Display statistics about the index.
laurus get index
Table output example:
Document count: 42
Vector fields:
╭──────────┬─────────┬───────────╮
│ Field │ Vectors │ Dimension │
├──────────┼─────────┼───────────┤
│ text_vec │ 42 │ 384 │
╰──────────┴─────────┴───────────╯
JSON output example:
laurus --format json get index
{
"document_count": 42,
"fields": {
"text_vec": {
"vector_count": 42,
"dimension": 384
}
}
}
get doc
Retrieve a document (and all its chunks) by external ID.
laurus get doc --id <ID>
Table output example:
╭──────┬─────────────────────────────────────────╮
│ ID │ Fields │
├──────┼─────────────────────────────────────────┤
│ doc1 │ body: This is a test, title: Hello World │
╰──────┴─────────────────────────────────────────╯
JSON output example:
laurus --format json get doc --id doc1
[
{
"id": "doc1",
"document": {
"title": "Hello World",
"body": "This is a test document."
}
}
]
add — Add a Resource
add doc
Add a document to the index. Documents are not searchable until commit is called.
laurus add doc --id <ID> --data <JSON>
Arguments:
| Flag | Required | Description |
|---|---|---|
--id <ID> | Yes | External document ID (string) |
--data <JSON> | Yes | Document fields as a JSON string |
The JSON format is a flat object mapping field names to values:
{
"title": "Introduction to Rust",
"body": "Rust is a systems programming language.",
"category": "programming"
}
Example:
laurus add doc --id doc1 --data '{"title":"Hello World","body":"This is a test document."}'
# Document 'doc1' added. Run 'commit' to persist changes.
Tip: Multiple documents can share the same external ID (chunking pattern). Use
add docfor each chunk.
delete — Delete a Resource
delete doc
Delete a document (and all its chunks) by external ID.
laurus delete doc --id <ID>
Example:
laurus delete doc --id doc1
# Document 'doc1' deleted. Run 'commit' to persist changes.
commit
Commit pending changes (additions and deletions) to the index. Until committed, changes are not visible to search.
laurus commit
Example:
laurus --data-dir ./my_index commit
# Changes committed successfully.
search
Execute a search query using the Query DSL.
laurus search <QUERY> [--limit <N>] [--offset <N>]
Arguments:
| Argument / Flag | Required | Default | Description |
|---|---|---|---|
<QUERY> | Yes | — | Query string in Laurus Query DSL |
--limit <N> | No | 10 | Maximum number of results |
--offset <N> | No | 0 | Number of results to skip |
Query syntax examples:
# Term query
laurus search "body:rust"
# Phrase query
laurus search 'body:"machine learning"'
# Boolean query
laurus search "+body:programming -body:python"
# Fuzzy query (typo tolerance)
laurus search "body:programing~2"
# Wildcard query
laurus search "title:intro*"
# Range query
laurus search "price:[10 TO 50]"
Table output example:
╭──────┬────────┬─────────────────────────────────────────╮
│ ID │ Score │ Fields │
├──────┼────────┼─────────────────────────────────────────┤
│ doc1 │ 0.8532 │ body: Rust is a systems..., title: Intr │
│ doc3 │ 0.4210 │ body: JavaScript powers..., title: Web │
╰──────┴────────┴─────────────────────────────────────────╯
JSON output example:
laurus --format json search "body:rust" --limit 5
[
{
"id": "doc1",
"score": 0.8532,
"document": {
"title": "Introduction to Rust",
"body": "Rust is a systems programming language."
}
}
]
repl
Start an interactive REPL session. See REPL for details.
laurus repl
serve
Start the gRPC server. See gRPC Server for full documentation.
laurus serve [OPTIONS]
Options:
| Option | Short | Env Variable | Default | Description |
|---|---|---|---|---|
--config <PATH> | -c | LAURUS_CONFIG | — | Path to a TOML configuration file |
--host <HOST> | -H | LAURUS_HOST | 0.0.0.0 | Listen address |
--port <PORT> | -p | LAURUS_PORT | 50051 | Listen port |
--log-level <LEVEL> | -l | LAURUS_LOG_LEVEL | info | Log level (trace, debug, info, warn, error) |
Example:
# Start with defaults (port 50051)
laurus --data-dir ./my_index serve
# Custom port and log level
laurus serve --port 8080 --log-level debug
# Use a configuration file
laurus serve --config config.toml
# Use environment variables
LAURUS_DATA_DIR=./my_index LAURUS_PORT=8080 laurus serve