Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

gRPC API Reference

All services are defined under the laurus.v1 protobuf package.

Services Overview

ServiceRPCsDescription
HealthServiceCheckHealth checking
IndexServiceCreateIndex, GetIndex, GetSchema, AddField, DeleteField, UpdateFieldIndex lifecycle and schema
DocumentServicePutDocument, AddDocument, PutDocuments, AddDocuments, GetDocuments, DeleteDocuments, Commit, FlushWalDocument CRUD, bulk ingestion, commit, and WAL flush
SearchServiceSearch, SearchStream, SearchBatchUnary, streaming and batch search

HealthService

Check

Returns the current serving status of the server.

rpc Check(HealthCheckRequest) returns (HealthCheckResponse);

Response fields:

FieldTypeDescription
statusServingStatusSERVING_STATUS_SERVING when the server is ready

IndexService

CreateIndex

Create a new index with the given schema. Fails with ALREADY_EXISTS if an index is already open, if the data directory already holds an index (one another process created, for example), or if another process is creating or opening an index there at the same moment (Issue #1665), and with FAILED_PRECONDITION if the data directory has a store/ but no schema.toml (Issue #1560): the store/ may hold the documents of an earlier index, so nothing is written or removed. Restore schema.toml and restart the server to open that index, or remove store/ to create a new one. A server older than this check opened such a store/ as the new index’s storage and served its documents.

A schema the engine cannot use fails with INVALID_ARGUMENT, as from AddField, and creates nothing: an analyzer that is not defined or has a wrong setting (such as a malformed regular expression), or an embedder that is not declared or does not fit its field. A Lindera dictionary that cannot be loaded fails with INTERNAL. A server older than Issue #1730 answered INTERNAL to all of these.

rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse);

Request fields:

FieldTypeRequiredDescription
schemaSchemaYesIndex schema definition

Schema structure:

message Schema {
  map<string, FieldOption> fields = 1;
  repeated string default_fields = 2;
  map<string, AnalyzerDefinition> analyzers = 3;
  map<string, EmbedderConfig> embedders = 4;
  DynamicFieldPolicy dynamic_field_policy = 5;
}

enum DynamicFieldPolicy {
  DYNAMIC_FIELD_POLICY_UNSPECIFIED = 0;
  DYNAMIC_FIELD_POLICY_STRICT = 1;
  DYNAMIC_FIELD_POLICY_DYNAMIC = 2;
  DYNAMIC_FIELD_POLICY_IGNORE = 3;
}
  • fields — Field definitions keyed by field name.
  • default_fields — Field names used as default search targets when a query does not specify a field.
  • analyzers — Custom analyzer pipelines keyed by name. Referenced by TextOption.analyzer.
  • embedders — Embedder configurations keyed by name. Referenced by vector field options (HnswOption.embedder, etc.).
  • dynamic_field_policy — How the engine treats fields that appear in an ingested document but are absent from fields. UNSPECIFIED is interpreted as DYNAMIC for forward compatibility. CreateIndex rejects a value the server does not know as INVALID_ARGUMENT instead of treating it as DYNAMIC (Issue #1473). See Schema & Fields for the full behaviour matrix and the warning about silent truncation under DYNAMIC.

AnalyzerDefinition:

message AnalyzerDefinition {
  repeated ComponentConfig char_filters = 1;
  ComponentConfig tokenizer = 2;
  repeated ComponentConfig token_filters = 3;
}

ComponentConfig (used for char filters, tokenizer, and token filters):

FieldTypeDescription
configgoogle.protobuf.StructThe component in the shape schema.toml uses: its type and its parameters, such as {"type": "stop", "words": ["new,york", "the"]} or {"type": "ngram", "min_gram": 2, "max_gram": 3}. See Schema Format → Analyzers for the keys of each type
type, paramsstring, map<string, string>Deprecated; must be empty (see below)

config is read by the rules schema.toml is read by: a missing required key, an unknown type, a key the component does not take (also on one that takes no parameters, such as "words" on a lowercase filter; Issue #1700), or a value of the wrong type (the string "2" for min_gram, "False" for a boolean) is rejected with INVALID_ARGUMENT, and the message names the analyzer and the component, such as Analyzer 'a': token_filters[0]: unknown field `words`, there are no fields. A stop word, a mapping key and every other string are stored as sent. Two things differ from schema.toml, since config is a protobuf Struct: numbers are doubles, so a whole number such as 2.0 also fills an integer parameter, and a top-level null is the same as omitting the key, so a key the component does not take is not reported when its value is null: it sets nothing. GetSchema returns each component in the same shape, with the defaults filled in and an unset optional parameter left out.

Before Issue #1478, a component was type and params, a map of strings: a stop filter’s words was one comma-separated string, so a word with a comma could not be sent and each word was trimmed, and a missing form, replacement or Lindera mode was filled in. A server since then rejects a component that sets type or params with INVALID_ARGUMENT, and a client since then (such as laurus-mcp) rejects one in a GetSchema response; a server from before then rejects a component with an empty type as an unknown type. So a server and a client on either side of that change fail instead of building a component with defaults.

EmbedderConfig:

FieldTypeDescription
configgoogle.protobuf.StructThe embedder in the shape schema.toml uses: its type and its parameters, such as {"type": "precomputed"} or {"type": "candle_colbert", "model": "colbert-ir/colbertv2.0", "query_maxlen": 32}. See Schema Format → Embedders for the keys of each type
type, paramsstring, map<string, string>Deprecated; must be empty (see below)

config is read by the rules schema.toml is read by, as a component’s is (Issue #1702): a missing required key, an unknown type, a key the type does not take (such as "model" on a precomputed embedder) or a value of the wrong type (the string "32" for query_maxlen) is rejected with INVALID_ARGUMENT, and the message names the embedder, such as Embedder 'e': unknown field `model`, there are no fields. A whole number such as 32.0 also fills query_maxlen or doc_maxlen, and a top-level null is the same as omitting the key. GetSchema returns each embedder in the same shape, with an unset optional parameter left out.

Before Issue #1702, an embedder was type and params, a map of strings read key by key: query_maxlen and doc_maxlen were decimal strings, and a parameter the type does not take was dropped. A server since then rejects an embedder that sets type or params with INVALID_ARGUMENT, and a client since then (such as laurus-mcp) rejects one in a GetSchema response; a server from before then rejects an embedder with an empty type as an unknown type. So a server and a client on either side of that change fail instead of creating a different embedder.

Each FieldOption is a oneof with one of the following field types:

Lexical FieldsVector Fields
TextOption (indexed, stored, multi_valued, position_increment_gap, term_vectors, doc_values, analyzer)HnswOption (dimension, distance, m, ef_construction, base_weight, quantizer, embedder, default_ef_search, rerank_storage, pq_codebook_path)
IntegerOption (indexed, stored, multi_valued, doc_values)FlatOption (dimension, distance, base_weight, quantizer, embedder, rerank_storage)
FloatOption (indexed, stored, multi_valued, doc_values)IvfOption (dimension, distance, n_clusters, n_probe, base_weight, quantizer, embedder, rerank_storage)
BooleanOption (indexed, stored, multi_valued, doc_values)MultiVectorOption (dimension, distance, embedder, storage)
DateTimeOption (indexed, stored, multi_valued, doc_values)
GeoOption (indexed, stored, multi_valued, doc_values)
Geo3dOption (indexed, stored, multi_valued, doc_values)
BytesOption (stored, multi_valued)

The embedder field in vector options specifies the name of an embedder defined in Schema.embedders. When set, the server automatically generates vectors from document text fields at index time. Leave empty to supply pre-computed vectors directly.

Indexed and stored: indexed and stored are optional bool on every lexical option above (BytesOption has only stored; Issue #1709). A client that leaves one out gets the engine’s default (true), as an omitted key in schema.toml does, distinguishable from an explicit false. UpdateField replaces the whole option, so one left out there is true as well, not the field’s current value. They were plain bools before this change, so a server older than it reads one left out as false and creates a field that is neither searchable nor returned; set both when talking to an older server. A client generated from that older proto puts nothing on the wire for an explicit false, so this server reads it as unset and indexes or stores the field after all; to turn either off, regenerate such a client from the current proto. MCP (laurus-mcp) older than the server is such a client.

Doc values: doc_values (Issue #1047) is optional bool on every lexical option above except BytesOption, following the same tri-state contract as term_vectors: a client that omits it gets the engine’s default (true), distinguishable from an explicit false. It controls whether the field’s value is also copied into DocValues, the column-oriented store sorting and faceting/aggregation read from — a DocValues column is written only when stored and doc_values are both true. BytesOption carries no such field: a Bytes value is never written to DocValues regardless. Turning doc_values off for a field that is never sorted or faceted on shrinks its segment footprint; the field remains fully searchable and retrievable either way.

Multi-valued geo, datetime, boolean, text and bytes: multi_valued on GeoOption / Geo3dOption (Issue #1174), on DateTimeOption (Issue #1184) and on BooleanOption (Issue #1180) is proto field number 4 — 3 is already taken by doc_values there, unlike IntegerOption / FloatOption; on TextOption (Issue #1175) it is field number 6, because Text already used 3–5 for term_vectors, analyzer and doc_values; on BytesOption (Issue #1176) it is field number 2 — 1 is already taken by stored, and BytesOption has neither an indexed nor a doc_values field. When true, a geo field accepts GeoArrayValue / Geo3dArrayValue (see the Value table below) and distance / bounding-box queries (plus geo3d_nearest) match a document if any of its points satisfies the predicate, scoring it by its closest point. A datetime field accepts DatetimeArrayValue (repeated int64 Unix microseconds UTC, the same encoding as datetime_value) and range queries match a document if any of its instants is in range, with constant scoring; a document is reported once even when several instants match. A boolean field accepts BoolArrayValue (repeated bool) and a term query matches a document if any element equals the queried value; each element is indexed as its own true / false term posting — there are no BKD points for booleans — so repeated elements raise the term frequency (and hence the BM25 score), not the hit count. A text field accepts TextArrayValue (repeated string) and a term query matches a document if any element contains the term; position_increment_gap (field 7, optional uint32) is the number of positions inserted between consecutive elements, which keeps a phrase query from spanning two elements unless its slop reaches the gap. It is optional for the same reason term_vectors / doc_values are: an omitted value means the engine default (100), not 0. A bytes field accepts BytesArrayValue (repeated bytes); since a Bytes value is never lexically indexed, this has no “any match” query semantics at all — it only governs the stored/wire shape and ingestion arity — and, like the scalar bytes_value, the per-element MIME type carried by DataValue::BytesArray is not represented on the wire.

Multi-vector fields: MultiVectorOption (FieldOption field 12, Issue #1177) declares a field that holds each document’s token vectors (for example ColBERT-style per-token embeddings) for late-interaction rescoring. It has no ANN index and is not a vector-search target: a query_vectors entry naming it is rejected. distance must be COSINE (vectors are L2-normalized when written) or DOT_PRODUCT. Values are VectorArrayValues (see the Value table below), and the field is not stored, so documents returned by the server never include it. embedder (field 3, Issue #1349) names a token-level embedder ("candle_colbert") from Schema.embedders; when set, a document may give the field a text_value, which is embedded into token vectors. A MultiVector field accepts only a "candle_colbert" or "precomputed" embedder, and other vector fields do not accept "candle_colbert".

Multi-vector storage: the optional storage field (field 4, enum MultiVectorStorage, Issue #1346) picks the on-disk element kind of the token vectors: UNSPECIFIED = same as F32, F32 (default, 4 bytes/element, exact), F16 (2 bytes/element, ~2⁻¹¹ relative error per element), INT8 (~1 byte/element plus a small per-vector scale overhead — dimension + 2 bytes/row total — using a per-vector scale max(abs(vector)) / 127, not trained per-segment or over the corpus), or BINARY (1 bit/element — ceil(dimension / 8) bytes/row — against a center the field learns once; requires distance COSINE). At 300 tokens × 128 dimensions (~150 KB/document in F32), F16 is ~75 KB/document, INT8 ~38 KB/document and BINARY ~4.7 KB/document. Unset keeps F32. CreateIndex, AddField and UpdateField reject a value the server does not know as INVALID_ARGUMENT instead of storing the field as F32 (Issue #1473). A server older than this check stores such a field as F32 without an error, so check the returned schema when talking to an older server.

Multi-vector token pooling: the optional pool_factor field (field 5, uint32, Issue #1346) makes each document keep about 1 / pool_factor of its token vectors: the first one, then the means of Ward clusters of the others. Unset means 1, no pooling; 0 is rejected. Turning pooling on for an existing field is a reindex; changing or turning off a factor in use is destructive. See Token pooling.

Distance metrics: COSINE (the zero value, so the default when distance is unset), EUCLIDEAN, MANHATTAN, DOT_PRODUCT, ANGULAR. CreateIndex, AddField and UpdateField reject a value the server does not know as INVALID_ARGUMENT instead of building the field with COSINE (Issue #1473); a server older than this check uses COSINE without an error.

Quantization methods: SCALAR_8BIT (default), PRODUCT_QUANTIZATION (Issue #481 Stage 3; supported by the HNSW index only — CreateIndex, AddField and UpdateField reject it on a Flat / IVF field as INVALID_ARGUMENT, Issue #1457), FLOAT16 (Issue #623; IEEE 754 half precision, 2 bytes per dimension, nothing to train; supported by HNSW, Flat and IVF — see Float16), PRODUCT_QUANTIZATION_FASTSCAN (Issue #695; experimental, HNSW only, and only on a server built with the pq-fastscan feature). CreateIndex, AddField and UpdateField reject a value the server does not know, and PRODUCT_QUANTIZATION_FASTSCAN on a server built without pq-fastscan, as INVALID_ARGUMENT instead of storing the field as SCALAR_8BIT (Issue #1459). A server that predates FLOAT16 predates this check as well and stores such a field as SCALAR_8BIT without an error, so check the returned schema when talking to an older server.

NONE (no quantization) was removed in Issue #481 Stage 1. The proto enum value 0 (QUANTIZATION_METHOD_NONE) is what a client that leaves method unset sends, so it is kept: the server stores the field as SCALAR_8BIT, the default.

Rerank storage: the optional rerank_storage field (enum RerankStorageKind: UNSPECIFIED = no sidecar, F32) enables the Stage-2 rerank sidecar (Issue #481 / #793). When set to F32 on an HNSW field, commit writes an extra full-precision .hnsw.f32 sidecar so searches that set rerank_factor rescore int8 candidates against the original vectors. Omitting the field (or UNSPECIFIED) keeps Stage-1 int8-only ranking; CreateIndex, AddField and UpdateField reject a value the server does not know as INVALID_ARGUMENT instead of writing no sidecar (Issue #1473). Since #932 the sidecar is emitted and consumed by all three vector index types (HNSW / Flat / IVF), including a field-less query when the segment holds only one field (Issue #1388).

Shared PQ codebook: the optional pq_codebook_path field on HnswOption (Issue #631) names a storage-relative shared PQ codebook file, trained once via the laurus train pq-codebook CLI command. Segments are then encoded against the pre-trained codebook instead of re-training k-means on every commit and merge. Only meaningful with a PRODUCT_QUANTIZATION quantizer; when set but not yet trained, commits fail with an error naming the training command (no silent fallback to per-segment training). Unset keeps per-segment training.

Base weight: base_weight on HnswOption/FlatOption/IvfOption is optional float (Issue #1084): a client that omits it gets the engine’s default (1.0), distinguishable from an explicit 0.0. It sets the field’s relative scoring priority when a query targets it alongside other vector fields — see Vector Search → Weights for what it does and does not affect.

Graph and cluster parameters: m and ef_construction on HnswOption and n_clusters and n_probe on IvfOption are optional uint32 (Issue #1479): a client that omits one gets the engine’s default (m 16, ef_construction 200, n_clusters 100, n_probe 1), the same as a TOML schema. CreateIndex, AddField and UpdateField reject an m below 2, an ef_construction, n_clusters or n_probe of 0, and a dimension of 0 on any vector option as INVALID_ARGUMENT. dimension has no default over gRPC: it is a plain uint32, so an omitted one is 0 and rejected. UpdateField replaces the whole option, so a key omitted there also gets the default, not the field’s current value. A server older than this change reads an omitted value as 0, with which every document write fails (m) or every search returns no hits (n_probe), so set these explicitly when talking to an older server. An index such a server created still opens, with a warning in the server log; repair the field with UpdateField (a new m, ef_construction or n_clusters needs reindex, and a new n_probe takes effect at once, without restarting laurus serve). If the index does not open because a document write failed on it, that write is still in its write-ahead log: set a valid m in the index’s schema.toml and start the server again, and the write is applied.

Default ef_search: default_ef_search on HnswOption (field 8, optional uint32, Issue #644) is the size of the candidate list a search of the field uses when the request does not set VectorParams.ef_search. Unset leaves the choice to the engine; see Schema and Fields → default_ef_search. GetSchema returns it when it is set. The HTTP gateway takes it as a JSON integer between 0 and 4294967295, rejects anything else with 400, and shows it in its schema responses when it is set; a gateway older than Issue #1490 read a malformed value as unset and left the key out of those responses (see HTTP Gateway).

Product quantization subvector_count: with PRODUCT_QUANTIZATION or PRODUCT_QUANTIZATION_FASTSCAN, CreateIndex, AddField and UpdateField reject a subvector_count of 0 (what a client that leaves it unset sends), one that does not divide dimension, and one where subvector_count or dimension / subvector_count is above 65535, as INVALID_ARGUMENT (Issue #1491). A server older than this check accepts such a field and fails a later commit as INTERNAL: a count that does not divide dimension at the first commit that holds a vector of the field, and 0 once a segment of the field reaches 256 vectors (16 for FastScan); every later commit then fails as well. An index such a server created still opens, with a warning in the server log, and every document write to it fails, without being applied, until the field is repaired with UpdateField and a valid subvector_count (with reindex, which rebuilds the field from its segments). Until it is repaired, a compaction of the field (which deleting many of its documents triggers) fails on every commit: the commit still succeeds and logs the failure as a warning that names the field (Issue #1500), and the deleted vectors stay in the field, hidden from searches. If the index does not open because a commit failed on it, set a valid subvector_count in the index’s schema.toml and start the server again.

Product quantization distance: PRODUCT_QUANTIZATION and PRODUCT_QUANTIZATION_FASTSCAN support only Euclidean and Cosine (Issue #1458). CreateIndex, AddField and UpdateField reject other distances as INVALID_ARGUMENT. An existing index with an unsupported distance still opens with a warning; repair it with UpdateField, a non-PQ quantizer and the same distance to reindex and preserve its vectors. Changing the distance discards them.

QuantizationConfig structure:

FieldTypeDescription
methodQuantizationMethodQuantization method (QUANTIZATION_METHOD_SCALAR_8BIT, QUANTIZATION_METHOD_PRODUCT_QUANTIZATION, QUANTIZATION_METHOD_PRODUCT_QUANTIZATION_FASTSCAN = 3 or QUANTIZATION_METHOD_FLOAT16 = 4). 0 (NONE, an unset method) means SCALAR_8BIT; any other value is rejected as INVALID_ARGUMENT.
subvector_countuint32Number of subvectors (only used when method is PRODUCT_QUANTIZATION or PRODUCT_QUANTIZATION_FASTSCAN; must be at least 1 and evenly divide dimension, or the field is rejected as INVALID_ARGUMENT; ignored for SCALAR_8BIT and FLOAT16)

Example:

{
  "schema": {
    "fields": {
      "title": {"text": {"indexed": true, "stored": true, "term_vectors": true}},
      "embedding": {"hnsw": {"dimension": 384, "distance": "DISTANCE_METRIC_COSINE", "m": 16, "ef_construction": 200}}
    },
    "default_fields": ["title"]
  }
}

GetIndex

Get index statistics.

rpc GetIndex(GetIndexRequest) returns (GetIndexResponse);

Response fields:

FieldTypeDescription
document_countuint64Total number of documents in the index
vector_fieldsmap<string, VectorFieldStats>Per-field vector statistics

Each VectorFieldStats contains vector_count and dimension.

AddField

Add a new field to the running index at runtime.

rpc AddField(AddFieldRequest) returns (AddFieldResponse);

Request fields:

FieldTypeDescription
namestringThe field name
field_optionFieldOptionThe field configuration

Response fields:

FieldTypeDescription
schemaSchemaThe updated schema after the field has been added

HTTP gateway: POST /v1/schema/fields

DeleteField

Remove a field from the running index schema.

rpc DeleteField(DeleteFieldRequest) returns (DeleteFieldResponse);

Request fields:

FieldTypeDescription
namestringThe field name to remove

Response fields:

FieldTypeDescription
schemaSchemaThe updated schema after removal

A lexical field’s data is discarded from every segment, which takes time in proportion to the index. A vector field’s files stay until a field with the same name is added again. Per-field analyzers and embedders are unregistered. A field added again with the same name starts empty (see Removing a Field).

HTTP gateway: DELETE /v1/schema/fields/{name}

UpdateField

Change an existing field’s type or options on the running index.

rpc UpdateField(UpdateFieldRequest) returns (UpdateFieldResponse);

Request fields:

FieldTypeDescription
namestringThe field to change; it must already exist
field_optionFieldOptionThe field’s new configuration. It replaces the whole option: a value left unset is not taken from the field’s current option (see Graph and cluster parameters under CreateIndex for what an unset value becomes)
reindexboolMust be true to apply a REINDEX or DESTRUCTIVE change; ignored for a METADATA_ONLY change
dry_runboolWhen true, classify the change and return the classification without applying anything

Response fields:

FieldTypeDescription
classificationFieldChangeKindHow the change was classified
schemaSchemaThe schema after the change; unchanged when dry_run is true

FieldChangeKind is one of:

ValueMeaning
FIELD_CHANGE_KIND_METADATA_ONLYNo existing data is affected, and the change is always applied (e.g. an HNSW field’s default_ef_search)
FIELD_CHANGE_KIND_REINDEXThe field is rebuilt from the data already in the index (e.g. an HNSW field’s m or ef_construction, or a vector field’s index kind among HNSW, Flat and IVF)
FIELD_CHANGE_KIND_DESTRUCTIVEThe field’s existing data is discarded (e.g. a vector field’s dimension, distance or embedder, or its index kind to or from MultiVector), and the field is added to Schema.pending_reindex

See Changing a Field for the full rules. A REINDEX or DESTRUCTIVE change sent without reindex is rejected as INVALID_ARGUMENT, and nothing is applied.

HTTP gateway: PATCH /v1/schema/fields/{name}

GetSchema

Retrieve the current index schema.

rpc GetSchema(GetSchemaRequest) returns (GetSchemaResponse);

Response fields:

FieldTypeDescription
schemaSchemaThe index schema

With no index open, GetSchema answers FAILED_PRECONDITION with No index is open, as the other calls that need an index do, also when another process has written a schema.toml into the data directory since the server started (Issue #1724). A server older than this fix answered INTERNAL, naming the OS error of the missing schema.toml twice.


DocumentService

PutDocument

Insert or replace a document by ID. If a document with the same ID already exists, it is replaced.

rpc PutDocument(PutDocumentRequest) returns (PutDocumentResponse);

Request fields:

FieldTypeRequiredDescription
idstringYesExternal document ID
documentDocumentYesDocument content

Document structure:

message Document {
  map<string, Value> fields = 1;
}

Each Value is a oneof with these types:

TypeProto FieldDescription
Nullnull_valueNull value
Booleanbool_valueBoolean value
Integerint64_value64-bit signed integer
Floatfloat64_value64-bit floating point
Texttext_valueUTF-8 string
Bytesbytes_valueRaw bytes
Vectorvector_valueVectorValue (list of floats)
DateTimedatetime_valueUnix microseconds (UTC)
Geogeo_valueGeoPoint (latitude, longitude)
Int64Arrayint64_array_valueInt64ArrayValue (multi-valued integers; requires IntegerOption.multi_valued = true)
Float64Arrayfloat64_array_valueFloat64ArrayValue (multi-valued floats; requires FloatOption.multi_valued = true)
Geo3dgeo3d_valueGeo3dPoint (x, y, z meters; ECEF Cartesian)
GeoArraygeo_array_valueGeoArrayValue (repeated GeoPoint; multi-valued 2D points; requires GeoOption.multi_valued = true)
Geo3dArraygeo3d_array_valueGeo3dArrayValue (repeated Geo3dPoint; multi-valued 3D points; requires Geo3dOption.multi_valued = true)
DateTimeArraydatetime_array_valueDatetimeArrayValue (repeated int64 Unix microseconds; multi-valued instants; requires DateTimeOption.multi_valued = true)
BoolArraybool_array_valueBoolArrayValue (repeated bool; multi-valued booleans; requires BooleanOption.multi_valued = true)
TextArraytext_array_valueTextArrayValue (repeated string; multi-valued text; requires TextOption.multi_valued = true)
BytesArraybytes_array_valueBytesArrayValue (repeated bytes; multi-valued bytes, MIME not carried on the wire; requires BytesOption.multi_valued = true)
VectorArrayvector_array_valueVectorArrayValue (uint32 dimension, repeated float values; token vectors packed row-major, values.len() / dimension vectors; requires a MultiVectorOption field)

Geo3dPoint:

FieldTypeDescription
xdoubleX coordinate in meters (ECEF: equatorial plane, +X toward 0° longitude)
ydoubleY coordinate in meters (ECEF: equatorial plane, +Y toward 90°E)
zdoubleZ coordinate in meters (ECEF: +Z toward the North Pole)

See 3D Geographic Search (ECEF) for the full coordinate system description and the wgs84_to_ecef / ecef_to_wgs84 conversion utilities.

AddDocument

Add a document. Unlike PutDocument, this does not replace existing documents with the same ID — multiple documents can share an ID (chunking pattern).

rpc AddDocument(AddDocumentRequest) returns (AddDocumentResponse);

Request fields are the same as PutDocument.

PutDocuments

Batched upsert. Entries are applied sequentially, in input order, with one WAL fsync for the whole batch — much faster than one PutDocument call per document. Duplicate IDs within one batch dedup exactly like the same puts issued one by one (the last occurrence wins).

rpc PutDocuments(PutDocumentsRequest) returns (PutDocumentsResponse);

message DocumentEntry {
  string id = 1;
  Document document = 2;
}

message PutDocumentsRequest {
  repeated DocumentEntry documents = 1;
}

message PutDocumentsResponse {
  uint32 applied = 1; // equals the request size on success
}

The call fails fast at the first entry that cannot be applied. Already-applied entries are not rolled back — they are durable at the next commit — and the error status message carries the failing position, its ID, and the applied count, so retrying the batch (or its suffix) is idempotent. A batch that fails on a caller mistake (e.g. a schema violation) returns INVALID_ARGUMENT; storage failures return INTERNAL.

AddDocuments

Batched chunk append. Like PutDocuments but never deletes existing documents, so a batch may legitimately repeat an ID to add multiple chunks of the same logical document.

rpc AddDocuments(AddDocumentsRequest) returns (AddDocumentsResponse);

Request/response fields mirror PutDocuments.

GetDocuments

Retrieve all documents matching the given external ID.

rpc GetDocuments(GetDocumentsRequest) returns (GetDocumentsResponse);

Request fields:

FieldTypeRequiredDescription
idstringYesExternal document ID

Response fields:

FieldTypeDescription
documentsrepeated DocumentMatching documents

DeleteDocuments

Delete all documents matching the given external ID.

rpc DeleteDocuments(DeleteDocumentsRequest) returns (DeleteDocumentsResponse);

Commit

Commit pending changes (additions and deletions) to the index. Changes are not visible to search until committed.

rpc Commit(CommitRequest) returns (CommitResponse);

FlushWal

Force buffered WAL records durable without a full commit. Both messages are empty. This is a near no-op under the default per-record sync policy (every write is already fsync’d); under the group-commit policy it flushes the current partial batch on demand, bounding the crash-loss window. Unlike Commit, it does not materialize segments, so buffered changes remain invisible to search until a subsequent Commit.

rpc FlushWal(FlushWalRequest) returns (FlushWalResponse);

message FlushWalRequest {}

message FlushWalResponse {}

The WAL durability policy is configured server-side via the [index.wal] config section. See Configuration → [index.wal] Section and Persistence & WAL → WAL Durability Policy.

HTTP gateway: POST /v1/flush_wal


SearchService

Execute a search query and return results as a single response.

rpc Search(SearchRequest) returns (SearchResponse);

Response fields:

FieldTypeDescription
resultsrepeated SearchResultSearch results ordered by relevance
total_hitsTotalHitsThe number of matching documents, set only when the request’s track_total_hits asked for it (Issue #1472)

Field 2 was a uint64 total_hits that held the number of returned results rather than the number of matches its description promised; it was removed (Issue #1455) and its number stays reserved. Field 3 holds the count.

SearchStream

Execute a search query and stream results back one at a time.

rpc SearchStream(SearchRequest) returns (stream SearchResult);

With group_by, each message is one group: its best hit, with the group’s next best hits in inner_hits.

The stream has no message for a total, so a request whose track_total_hits asks for one (up_to, or exact: true) is rejected with INVALID_ARGUMENT before the search runs (Issue #1472). Use Search for a total.

SearchBatch

Execute several independent searches in one call (Issue #714). The server runs them in parallel and returns one SearchResponse per query, in the order of queries.

rpc SearchBatch(SearchBatchRequest) returns (SearchBatchResponse);

message SearchBatchRequest {
  repeated SearchRequest queries = 1;
}

message SearchBatchResponse {
  repeated SearchResponse results = 1;
}

Request fields:

FieldTypeDescription
queriesrepeated SearchRequestThe searches to run, each with the fields of a Search request

Response fields:

FieldTypeDescription
resultsrepeated SearchResponseOne response per query, in the order of queries

Each response has the total_hits its own query’s track_total_hits asked for, and none for a query that asked for none (Issue #1472).

An empty queries returns an empty results. Every query is read before any runs, and one the server rejects while reading it, such as a query whose offset + limit exceeds max_result_window, fails the call with a message that starts with its position (queries[1]: ...). An error from the engine while the queries run, such as an unknown field in the query or a group_by out of range, fails the whole call the same way, with the engine’s message after the position and the status code of that error (Issue #1553): queries[1]: Invalid argument: query references unknown field(s) ["nosuch"]; .... When several queries fail, the message names the first to fail, which is not necessarily the lowest position. Either way, no results are returned.

With the four chunks of the grouping example, a batch of two searches returns each one’s hits. The server has no reflection, so grpcurl is given the proto files; it prints the proto3 JSON names, such as textValue for text_value:

grpcurl -plaintext -import-path laurus-server/proto -proto laurus/v1/search.proto \
  -d '{"queries": [{"query": "body:ownership"}, {"query": "body:garbage", "limit": 1}]}' \
  localhost:50051 laurus.v1.SearchService/SearchBatch
{
  "results": [
    {
      "results": [
        {
          "id": "manual",
          "score": 0.7456221,
          "document": {
            "fields": {
              "body": {
                "textValue": "Rust ownership rules for Rust programs"
              }
            }
          }
        }
      ]
    },
    {
      "results": [
        {
          "id": "faq",
          "score": 0.92279965,
          "document": {
            "fields": {
              "body": {
                "textValue": "Why Rust has no garbage collector"
              }
            }
          }
        }
      ]
    }
  ]
}

A second query with "offset": 10000, "limit": 1 fails the batch:

ERROR:
  Code: InvalidArgument
  Message: queries[1]: offset + limit (10001) exceeds the max result window (10000); page with a smaller offset, or raise server.max_result_window (--max-result-window)

SearchRequest Fields

FieldTypeRequiredDescription
querystringNoUnified query in Query DSL: lexical clauses and vector clauses. An unknown field is rejected with INVALID_ARGUMENT. lexical_params and field_boosts apply to its lexical part
query_vectorsrepeated QueryVectorNoPre-embedded query vectors. Sent with query, they are added to its vector part; a query with only lexical clauses becomes a hybrid search (Issue #1366)
limituint32NoMaximum number of results (0 means the engine default, 10). offset + limit must not exceed the server’s max_result_window (default 10,000), or the search is rejected with INVALID_ARGUMENT (Issue #1367)
offsetuint32NoNumber of results to skip; counts toward max_result_window with limit
fusionFusionAlgorithmNoFusion algorithm for hybrid search. Unset uses RRF with k 60. An out-of-range parameter (see FusionAlgorithm) is rejected with INVALID_ARGUMENT, even when the request has no hybrid part (Issue #1540)
lexical_paramsLexicalParamsNoLexical search parameters
vector_paramsVectorParamsNoVector search parameters
field_boostsmap<string, float>NoPer-field score boosting for the lexical part. A key must name a lexical field of the schema (or _id); an unknown or vector field is rejected with INVALID_ARGUMENT (Issue #1374). A lexical field the query does not use is accepted and has no effect. Each boost multiplies the field’s scores and must be finite and at least 0 (-0 is rejected); 0 keeps a match with a lexical score of 0. Any other boost is rejected with INVALID_ARGUMENT. Both the field and the boost are checked on a request without a query too (Issue #1540)
highlightHighlightParamsNoRequest highlighted fragments per field (Issue #1134)
rescoreRescoreParamsNoRescore the top first-stage results with late interaction (Issue #1351)
group_byGroupByParamsNoGroup the results by a field’s value; limit and offset then count groups (Issue #1297)
track_total_hitsTrackTotalHitsNoCount the matching documents and return the count in SearchResponse.total_hits (Issue #1472). Unset counts nothing (see TrackTotalHits)

At least one of query or query_vectors must be provided.

3D Geographic Queries

3D ECEF geographic queries are expressed in the lexical DSL string passed via SearchRequest.query. There is no dedicated message type — the same DSL forms used by the core library work over gRPC. Four forms are available (see Query DSL → 3D Geographic Queries for full syntax):

  • position:geo3d_distance(x, y, z, distance_m) — sphere centered at (x, y, z) with maximum distance in meters
  • position:geo3d_bbox(min_x, min_y, min_z, max_x, max_y, max_z) — 3D axis-aligned bounding box
  • position:geo3d_nearest(x, y, z, k) — k nearest neighbours to (x, y, z)
  • position:geo3d_polyline((x, y, z, ...), distance_m) — within distance_m meters of the straight segments through the vertices (x, y, z), in order

position is the field name; substitute the actual Geo3d-typed field declared in your schema. All numeric arguments are signed double values; k is an unsigned integer.

QueryVector

FieldTypeDescription
vectorrepeated floatQuery vector. A NaN or infinite component is rejected with INVALID_ARGUMENT, whatever the data (Issue #1573), and so is a vector whose dimension differs from a field it is searched in (Issue #1575; see fields)
weightfloatWeight for this vector (default: 1.0; 0 and -0 also mean 1.0, since proto3 cannot tell them from unset). Any other negative weight, or a non-finite one, is rejected with INVALID_ARGUMENT (Issue #1552)
fieldsrepeated stringTarget vector fields. Empty means VectorParams.fields if set, otherwise every vector field whose dimension matches. A field named here or picked by VectorParams.fields must have the vector’s dimension, or the search is rejected with INVALID_ARGUMENT, whatever the data (Issue #1575)

FusionAlgorithm

A oneof with two options:

  • RRF (Reciprocal Rank Fusion): each result list adds 1 / (k + rank), rank starting at 1. k (optional double) must be finite and at least 0. An unset k means 60, as over the HTTP gateway and MCP and as for an unset fusion; an explicit 0 is kept (Issue #1551).
  • WeightedSum: the min-max normalized lexical and vector scores, multiplied by lexical_weight and vector_weight (both optional float) and added. Each weight must be in [0, 1], and at least one greater than 0. An unset weight means 0.5, as over the HTTP gateway and MCP, so an empty WeightedSum weighs both sides 0.5; an explicit 0 is kept (Issue #1551).

Before Issue #1551 the three fields were plain proto3 scalars, so an unset k fused with k 0 and an empty WeightedSum was rejected. A client built from that proto cannot send an explicit 0 (proto3 omits it), so its 0 now means 60 or 0.5; a client built from the current proto sends an explicit 0 that is kept.

Any other value is rejected with INVALID_ARGUMENT (Issue #1540); weights used to be clamped to [0, 1].

LexicalParams

FieldTypeDescription
min_scorefloatMinimum lexical score. 0 (unset) means no threshold; lexical scores are never negative, so a negative value is the same. A non-finite value is rejected with INVALID_ARGUMENT, also on a request without a query (Issue #1540)
timeout_msoptional uint64Search timeout in milliseconds. Unset or 0 means no timeout
parallelboolEnable parallel search
sort_bySortSpecSort by a field instead of score

SortSpec

FieldTypeDescription
fieldstringField name to sort by. Empty string means sort by relevance score
orderSortOrderSORT_ORDER_ASC (ascending) or SORT_ORDER_DESC (descending). Any other value is rejected with INVALID_ARGUMENT, even when sort_by has no effect (no query, or an empty field); an older server sorted ascending (Issue #1476)

VectorParams

vector_params applies to the request’s vector part: query_vectors and the vector clauses of query (Issues #1342, #1366). A request with neither query_vectors nor query is rejected with INVALID_ARGUMENT. The server cannot tell whether query has vector clauses without parsing it; on a request whose only possible vector part is a query without vector clauses, vector_params has no effect. Every other value either takes effect or is rejected with INVALID_ARGUMENT.

FieldTypeDescription
fieldsrepeated stringVector fields (exact names) to search with query vectors that name no field. A query vector’s own fields take precedence, and every DSL vector clause names its field, so fields is rejected when no searched query_vectors entry names no field. An unknown name is rejected, and so is a field whose dimension differs from a query vector’s it is picked for (Issue #1575). Empty means every vector field whose dimension matches.
score_modeVectorScoreModeWEIGHTED_SUM, MAX_SIM, or LATE_INTERACTION. Any other value is rejected.
overfetchfloatEach per-field index query fetches ceil(limit * overfetch) candidates before scores are combined. 0 (unset) means the default, 2.0; a value in (0, 1] turns overfetch off. Negative or non-finite values are rejected.
min_scorefloatMinimum per-field similarity, compared before query and field weights are applied. 0 (unset) means no threshold; similarity is in [0, 1], so a negative value is the same. A non-finite value is rejected.
rerank_factoroptional uint32Stage 2 rerank widening factor (Issue #481). When set on a field whose schema enabled rerank_storage, the server widens the int8/PQ candidate fetch to top_k * rerank_factor and rescores the candidates against the original full-precision vectors before returning the top top_k. Honored on all three vector index types since #932 (HNSW, Flat, IVF), including a field-less query when the segment holds only one field (Issue #1388); fields without rerank_storage = "F32" silently fall back to int8 ranking — there is no f32 information to recover. A value of 0 or omitting the field disables rerank.
ef_searchoptional uint32Per-query override for the HNSW ef_search candidate-list size (Issue #644). Also gates the PQ → SQ → f32 three-stage rerank chain (Issue #673): on a PQ field with rerank_storage enabled, setting ef_search wider than top_k * rerank_factor activates an extra int8 stage that rescores the graph’s full candidate set — derived from the same rerank_storage sidecar, no extra configuration needed — before the exact stage’s narrower budget is carved out of it. 0 is rejected. Ignored on non-HNSW fields.

HighlightParams

Requests highlighted fragments for specific fields (Issue #1134). Highlighting uses SearchRequest.query (or the lexical clause of a DSL query), the same query that drives lexical scoring — filter_query never contributes highlighted terms, and a vector-only request (no lexical query) produces no highlights. Only stored: true text fields can be highlighted; other names are silently skipped. See Highlighting for full semantics.

FieldTypeDescription
fieldsrepeated stringStored text fields to highlight. Required — a request with this unset or empty is rejected with INVALID_ARGUMENT
max_fragmentsoptional uint32Maximum fragments per field (default: 5). 0 is rejected
fragment_sizeoptional uint32Target fragment length in characters (default: 150). 0 is rejected
tagoptional stringHTML tag to wrap matches (default: "mark"). An empty string is treated as unset
css_classoptional stringCSS class added to the tag. An empty string is treated as unset
require_field_matchoptional boolOnly use query terms that target the highlighted field (default: true)
max_analyzed_charsoptional uint64Maximum characters of a field’s text to analyze (default: 1,000,000)
return_entire_field_if_no_highlightoptional boolReturn the full field value as one fragment when nothing matched (default: false)

Highlights

FieldTypeDescription
fragmentsrepeated stringHighlighted fragments for one field, best fragment first

RescoreParams

Reorders the top window_size first-stage results (lexical, vector or hybrid) with ColBERT-style late interaction over a MultiVector field (Issue #1351). See Late-Interaction Rescore for the scoring and ordering rules.

FieldTypeDescription
window_sizeoptional uint32How many top first-stage results to rescore, 1 to 10,000. Unset means 100
late_interactionLateInteractionRescoreThe rescorer (a oneof; required)

LateInteractionRescore:

FieldTypeDescription
fieldstringA MultiVector field
vectorsVectorArrayValueThe query’s token vectors, packed row-major like a document value (1 to 1,024 vectors of the field’s dimension). One of vectors and text is required
textstringQuery text, embedded by the field’s token-level embedder (a candle_colbert one)

The engine validates the values: an out-of-range window, a field that is not a MultiVector field, the wrong number or dimension of vectors, text for a field without a token-level embedder, or a rescore combined with lexical_params.sort_by is rejected with INVALID_ARGUMENT, as is a RescoreParams without late_interaction or a query.

GroupByParams

Folds the ranked results (after fusion and rescore) that share a field’s value into groups, ordered by each group’s best result (Issue #1297). See Result Grouping for the rules.

FieldTypeDescription
fieldstring_id, or a single-valued, stored Text, Integer, Float, Boolean or DateTime field with doc_values. A result with no value forms a group of its own
group_sizeoptional uint32Results kept per group, the returned one included, 1 to 100. Unset means 1

The engine validates the values: a field that cannot group, a group_size outside 1 to 100, or an offset + limit above 10,000 is rejected with INVALID_ARGUMENT.

TrackTotalHits

How far a search counts its matches (Issue #1472). One of the fields of oneof mode is set. An unset track_total_hits, exact: false and a message without mode count nothing, which costs nothing.

FieldTypeDescription
up_touint64Count exactly up to this many matches. From it on, the total is a lower bound: value is up_to and relation is TOTAL_HITS_RELATION_AT_LEAST. 0 is rejected with INVALID_ARGUMENT
exactbooltrue counts every match, exactly; false counts nothing

Counting has a cost: until the count reaches the threshold, the search cannot skip the documents that block-max pruning would skip, so a higher threshold, or exact, is slower for a query with many matches. What the total counts for each kind of search (exactly or as a lower bound for a lexical search, as a lower bound for a vector or hybrid search, documents rather than groups with group_by) is described in Total hits.

TotalHits

FieldTypeDescription
valueuint64The number of matching documents, or a lower bound of it
relationTotalHitsRelationTOTAL_HITS_RELATION_EXACT: value is the number of matching documents. TOTAL_HITS_RELATION_AT_LEAST: at least value documents match

SearchResult

FieldTypeDescription
idstringExternal document ID
scorefloatRelevance score; for a rescored result, its late-interaction (MaxSim) score
documentDocumentDocument content
highlightsmap<string, Highlights>Highlighted fragments per field named in SearchRequest.highlight.fields. A field with no highlight is absent from this map
group_keyValueWith group_by: the value this result’s group shares. Unset for an ungrouped search and for a result without a value
inner_hitsrepeated SearchResultWith group_by: the group’s next best results, in ranking order. Each carries the same group_key and has no inner_hits of its own

Example

{
  "query": "body:rust",
  "query_vectors": [
    {"vector": [0.1, 0.2, 0.3], "weight": 1.0}
  ],
  "limit": 10,
  "fusion": {
    "rrf": {"k": 60}
  },
  "field_boosts": {
    "title": 2.0
  }
}

Example: Highlighting

{
  "query": "body:rust",
  "limit": 10,
  "highlight": {"fields": ["body"], "max_fragments": 2, "tag": "em"}
}

A matching hit’s SearchResult then carries:

{
  "id": "doc1",
  "score": 1.2,
  "document": {"fields": {"body": {"text_value": "Rust is great"}}},
  "highlights": {"body": {"fragments": ["<em>Rust</em> is great"]}}
}

Example: Rescore

A hybrid first stage whose top 100 results are rescored by a ColBERT embedder on body_colbert:

{
  "query": "body:lifetimes body_vec:\"how do lifetimes work\"",
  "limit": 10,
  "rescore": {
    "window_size": 100,
    "late_interaction": {"field": "body_colbert", "text": "how do lifetimes work"}
  }
}

With pre-computed query token vectors instead of text:

{
  "late_interaction": {
    "field": "body_colbert",
    "vectors": {"dimension": 2, "values": [1.0, 0.0, 0.0, 1.0]}
  }
}

Example: Grouping

Documents added as chunks with AddDocuments share their _id; grouping by it returns each document once, with up to one more of its chunks:

{
  "query": "body:rust",
  "limit": 10,
  "group_by": {"field": "_id", "group_size": 2}
}

Each SearchResult is then a group’s best chunk:

{
  "id": "manual",
  "score": 0.012571429,
  "document": {"fields": {"body": {"text_value": "Rust ownership rules for Rust programs"}}},
  "group_key": {"text_value": "manual"},
  "inner_hits": [
    {
      "id": "manual",
      "score": 0.012359549,
      "document": {"fields": {"body": {"text_value": "Borrowing in Rust"}}},
      "group_key": {"text_value": "manual"}
    }
  ]
}

Error Handling

gRPC errors are returned as standard Status codes:

Laurus ErrorgRPC StatusWhen
Schema / Query / Field / Invalid argument / JSONINVALID_ARGUMENTMalformed request or schema, a schema the engine cannot use (such as an analyzer that is not defined), unknown field in a query, a search whose offset + limit exceeds max_result_window
No index openFAILED_PRECONDITIONRPC called before CreateIndex
Writes stoppedFAILED_PRECONDITIONA write, commit or field change after an earlier write failed at or after its write-ahead-log append; restart the server to replay the log, which applies that write whole if its record reached the log in full, and otherwise not at all (see Failed Writes). A write whose call is cancelled, whose deadline expires or whose client disconnects does not stop writes: each of its documents is either applied in full or not written at all
Leftover storeFAILED_PRECONDITIONCreateIndex over a data directory that has a store/ but no schema.toml
Index already existsALREADY_EXISTSCreateIndex called twice, over an index another process created, or while another process creates or opens an index in the data directory
Not implementedUNIMPLEMENTEDFeature not yet supported
Internal errorsINTERNALI/O, storage, or unexpected errors, a Lindera dictionary that cannot be loaded