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, GetSchemaIndex lifecycle and schema
DocumentServicePutDocument, AddDocument, GetDocuments, DeleteDocuments, CommitDocument CRUD and commit
SearchServiceSearch, SearchStreamUnary and streaming 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.

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;
}

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

Lexical FieldsVector Fields
TextOption (indexed, stored, term_vectors)HnswOption (dimension, distance, m, ef_construction, base_weight, quantizer)
IntegerOption (indexed, stored)FlatOption (dimension, distance, base_weight, quantizer)
FloatOption (indexed, stored)IvfOption (dimension, distance, n_clusters, n_probe, base_weight, quantizer)
BooleanOption (indexed, stored)
DateTimeOption (indexed, stored)
GeoOption (indexed, stored)
BytesOption (stored)

Distance metrics: COSINE, EUCLIDEAN, MANHATTAN, DOT_PRODUCT, ANGULAR

Quantization methods: NONE, SCALAR_8BIT, PRODUCT_QUANTIZATION

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.

GetSchema

Retrieve the current index schema.

rpc GetSchema(GetSchemaRequest) returns (GetSchemaResponse);

Response fields:

FieldTypeDescription
schemaSchemaThe index schema

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 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)

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.

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);

SearchService

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

rpc Search(SearchRequest) returns (SearchResponse);

SearchStream

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

rpc SearchStream(SearchRequest) returns (stream SearchResult);

SearchRequest Fields

FieldTypeRequiredDescription
querystringNoLexical search query in Query DSL
query_vectorsrepeated QueryVectorNoVector search queries
limituint32NoMaximum number of results (default: engine default)
offsetuint32NoNumber of results to skip
fusionFusionAlgorithmNoFusion algorithm for hybrid search
lexical_paramsLexicalParamsNoLexical search parameters
vector_paramsVectorParamsNoVector search parameters
field_boostsmap<string, float>NoPer-field score boosting

At least one of query or query_vectors must be provided.

QueryVector

FieldTypeDescription
vectorrepeated floatQuery vector
weightfloatWeight for this vector (default: 1.0)
fieldsrepeated stringTarget vector fields (empty = all)

FusionAlgorithm

A oneof with two options:

  • RRF (Reciprocal Rank Fusion): k parameter (default: 60)
  • WeightedSum: lexical_weight and vector_weight

LexicalParams

FieldTypeDescription
min_scorefloatMinimum score threshold
timeout_msuint64Search timeout in milliseconds
parallelboolEnable parallel search
sort_bySortSpecSort by a field instead of score

VectorParams

FieldTypeDescription
fieldsrepeated stringTarget vector fields
score_modeVectorScoreModeWEIGHTED_SUM, MAX_SIM, or LATE_INTERACTION
overfetchfloatOverfetch factor (default: 2.0)
min_scorefloatMinimum score threshold

SearchResult

FieldTypeDescription
idstringExternal document ID
scorefloatRelevance score
documentDocumentDocument content

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
  }
}

Error Handling

gRPC errors are returned as standard Status codes:

Laurus ErrorgRPC StatusWhen
Schema / Query / Field / JSONINVALID_ARGUMENTMalformed request or schema
No index openFAILED_PRECONDITIONRPC called before CreateIndex
Index already existsALREADY_EXISTSCreateIndex called twice
Not implementedUNIMPLEMENTEDFeature not yet supported
Internal errorsINTERNALI/O, storage, or unexpected errors