hermes-server-1.3.2 is not a library.
Hermes Server
A high-performance gRPC search server for Hermes indexes.
Features
- Index Management: Create, delete, and manage search indexes
- Document Indexing: Stream or batch index documents
- Full-Text Search: Term queries, boolean queries, and boosting
- Document Retrieval: Get documents by ID
- Segment Management: Commit changes and force merge segments
Installation
Or build from source:
Usage
Starting the Server
Options:
-a, --addr: Address to bind to (default:0.0.0.0:50051)-d, --data-dir: Directory for storing indexes (default:./data)
gRPC API
The server exposes two services: SearchService and IndexService.
IndexService
CreateIndex
Create a new index with a schema definition (SDL or JSON format).
rpc CreateIndex(CreateIndexRequest) returns (CreateIndexResponse);
message CreateIndexRequest {
string index_name = 1;
string schema = 2; // SDL or JSON schema
}
SDL Schema Example:
index articles {
title: text indexed stored
body: text indexed stored
author: text indexed stored
published_at: u64 indexed stored
tags: text indexed stored
}
JSON Schema Example:
BatchIndexDocuments
Index multiple documents in a single request.
rpc BatchIndexDocuments(BatchIndexDocumentsRequest) returns (BatchIndexDocumentsResponse);
message BatchIndexDocumentsRequest {
string index_name = 1;
repeated NamedDocument documents = 2;
}
message NamedDocument {
map<string, FieldValue> fields = 1;
}
IndexDocuments (Streaming)
Stream documents for indexing.
rpc IndexDocuments(stream IndexDocumentRequest) returns (IndexDocumentsResponse);
Commit
Commit pending changes to make them searchable.
rpc Commit(CommitRequest) returns (CommitResponse);
ForceMerge
Merge all segments into one for optimal search performance.
rpc ForceMerge(ForceMergeRequest) returns (ForceMergeResponse);
DeleteIndex
Delete an index and all its data.
rpc DeleteIndex(DeleteIndexRequest) returns (DeleteIndexResponse);
SearchService
Search
Search for documents matching a query.
rpc Search(SearchRequest) returns (SearchResponse);
message SearchRequest {
string index_name = 1;
Query query = 2;
uint32 limit = 3;
uint32 offset = 4;
repeated string fields_to_load = 5;
}
Query Types:
- TermQuery: Match a specific term in a field
- BooleanQuery: Combine queries with must/should/must_not
- BoostQuery: Boost the score of a query
GetDocument
Retrieve a document by its ID.
rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse);
GetIndexInfo
Get information about an index (document count, segments, schema).
rpc GetIndexInfo(GetIndexInfoRequest) returns (GetIndexInfoResponse);
Field Types
| Type | Description |
|---|---|
text |
Full-text searchable string |
u64 |
Unsigned 64-bit integer |
i64 |
Signed 64-bit integer |
f64 |
64-bit floating point |
bytes |
Binary data |
json |
JSON object (stored as string) |
sparse_vector |
Sparse vector for semantic search |
dense_vector |
Dense vector for semantic search |
Example: Python Client
=
=
=
# Create index
=
# Index documents
=
# Commit
# Search
=
Docker
Build and run with Docker:
Or pull from GitHub Container Registry:
License
MIT