OpenSearch / Elasticsearch Compatibility¶
bdb-search (the benodb-search add-on) speaks the OpenSearch 1.x /
Elasticsearch 7.10 wire format. OpenSearch 1.x is the 7.10 fork, so the response
shapes, error envelopes, and query DSL target that dialect. GET / reports
version.number = "7.10.2" and tagline = "You know, you search".
This document lists exactly what is supported, what is not, and how to work around the gaps.
Supported¶
Cluster & metadata¶
Endpoint |
Notes |
|---|---|
|
Cluster info; ES 7.10 version block + tagline. |
|
Single-node health ( |
|
Aggregate index/node statistics. |
|
Tab-separated index summary ( |
|
Active cluster manager / master node info (OpenSearch 3.x and ES compatible). |
|
Tab-separated node status, resource, and role summary. |
|
Tab-separated shard allocation per index. |
|
Tab-separated cluster health and active shards. |
|
Node capabilities and HTTP coordinates for client connection sniffing. |
|
Cluster settings inspection and no-op acknowledgement. |
|
Compatibility shims for official Elastic clients probing security/license status. |
|
Pipeline definition stubs acknowledging ingest pipeline configuration. |
|
Prometheus text format (0.0.4) operational telemetry. |
Index management¶
Endpoint |
Notes |
|---|---|
|
Create an index, optionally with |
|
Returns |
|
Hard delete — removes all store objects (manifest, metadata, data, indexes). |
|
Renders the Arrow schema as ES properties ( |
|
Adds new properties via |
|
Field capabilities API returning types, searchability, aggregatability, metadata status, and conflict mappings across indices. |
Document lifecycle & updates¶
Endpoint |
Notes |
|---|---|
|
Index a doc with a server-generated id. Auto-creates the index on first write (schema-on-write). 201 |
|
Index a doc with a client-supplied id. Duplicate id → 400 |
|
Retrieve document by |
|
Soft/hard delete of document by |
|
Deletes matching documents across segments matching the query DSL. |
|
Partial document update ( |
|
Copies documents from source to destination index, supporting query filtering, field selection, |
|
NDJSON |
|
Flush the write buffer (memtable + WAL → segments + indexes) so new docs become searchable. |
Index aliases¶
Endpoint |
Notes |
|---|---|
|
Add/remove index aliases atomically. |
|
Retrieve registered aliases across cluster or per index. |
|
Create/assign alias to index. |
|
Remove alias from index. |
Aggregations¶
POST /{index}/_search accepts an aggs (or aggregations) object, compiled
to SQL and executed with DataFusion. Aggregations run over the top-level
filter (the query clause scopes aggregations via filter handoff).
Aggregation |
Notes |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Multi-source bucket pagination ( |
|
Foreground vs. background term frequency analysis with JLH significance scoring. |
Nested |
Supported on |
Search¶
Feature |
Notes |
|---|---|
|
Full query DSL (below). |
|
Lucene-style query string parsed with AST tokenizer; honours |
|
Document count, optionally filtered. |
|
BM25 (Okapi) lexical search over inverted indexes. Multi-field |
|
Exact phrase matching with configurable positional |
|
Multi-field full-text search across per-field BM25 inverted indexes. |
|
Lucene AST parser supporting boolean operators ( |
|
Levenshtein edit-distance matching with |
|
HNSW vector search. |
|
Fused with Reciprocal Rank Fusion (RRF). |
|
Returns all docs (uniform score 1.0). |
|
|
|
Multi-field sorting ( |
|
Keyset-backed stateless pagination via |
|
Snippet term highlighting ( |
|
|
|
Pagination (default |
|
Relational and graph-neighborhood query DSL support ( |
|
Nested query DSL for both single objects ( |
|
Explicit document id (reserved |
Snapshot & restore¶
Endpoint |
Notes |
|---|---|
|
List registered snapshot repositories. |
|
Retrieve snapshot repository configuration. |
|
Register or update snapshot repository. |
|
Unregister snapshot repository and clear cached metadata. |
|
Verify snapshot repository connectivity. |
|
Create snapshot, checkpointing target Iceberg tables and committing Parquet files. Supports |
|
Retrieve snapshot metadata across cluster or per repository. |
|
Retrieve snapshot completion status and shard progress. |
|
Restore snapshot checkpoint. |
|
Delete snapshot record. |
Error envelope & client handshake¶
Errors use the ES shape:
{ "error": { "type": "<exception>", "reason": "..." }, "status": <http_code> }
Mapped types include index_not_found_exception (404), resource_already_exists_exception
(400), search_context_missing_exception (404), repository_missing_exception (404),
snapshot_missing_exception (404), and illegal_argument_exception (400).
Client product validation headers¶
All HTTP responses include compatibility headers so official client SDKs (Python, Node.js, Go, Java) pass initialization and validation checks without error:
x-elastic-product: Elasticsearchx-opensearch-version: 3.0.0
Graceful fallback for unmapped endpoints¶
Any unmapped route or method triggers a global Axum fallback returning HTTP 400 with a standard ES error envelope:
{
"error": {
"type": "illegal_argument_exception",
"reason": "No handler found for uri [/unimplemented/route] and method [POST]"
},
"status": 400
}
This ensures upstream clients receive valid, parseable JSON error envelopes rather than unformatted 404/501 or text/HTML responses, preventing client JSON decoder crashes.
Not supported (v1)¶
Feature |
Behavior / workaround |
|---|---|
ILM (index lifecycle) |
Not implemented. |
Authentication / security |
Not implemented. Bind to |
Multi-node / sharding / replicas |
Single-node local daemon; for distributed workloads, shared Iceberg catalogs on S3/GCS with Flight SQL provide horizontal scale-out. |
Kibana |
No proprietary UI. See “Dashboards” below. |
Dashboards & observability¶
Grafana Elasticsearch datasource — point it at
http://<host>:9200to reuse existing Elasticsearch dashboards for basic search queries (the wire format is compatible for the supported endpoints).Grafana Prometheus datasource — scrape
GET /metricsfor operational dashboards (query p50/p95/p99, error rates, ingestion throughput, cache hit rates, in-flight requests).Data dashboards — because tables are standard Iceberg/Parquet, Grafana / Superset / DuckDB / Trino can query the same data directly for full SQL analytics (including aggregations that the REST API does not expose).
Positioning¶
BenoDB-Search is not a drop-in replacement for an in-memory, sub-millisecond Elasticsearch cluster. It is positioned for website search, document catalogs, and log archives where a 50–200 ms query latency envelope is imperceptible to users, and the object-storage-native, scale-to-zero operational model (on-demand index fetch from S3/RustFS, Iceberg/Parquet data-lake format, dynamic schema evolution, GPU-accelerated index builds) delivers a large TCO reduction versus a JVM + hot-SSD ES deployment.
Elasticsearch integration design¶
(merged from the former OPENSEARCH_COMPATIBILITY.md)
This document outlines the strategy for validating BenoDB’s production readiness and building an Elasticsearch-compatible REST API wrapper.
The REST API is implemented as a separate, optional add-on package (benodb-search) in the Cargo workspace. This ensures the core library remains lightweight, and users who only need library-level access or FFI bindings do not pull in HTTP dependencies.
Architectural Thesis: Cost-Efficiency & Serverless Over Low-Latency¶
Not In-Memory: Elasticsearch keeps all segments and caches aggressively pinned in RAM to achieve sub-millisecond query execution. This makes it operationally expensive and hard to run in serverless environments.
Target Workload (Website / Doc Search): For website search, document indexing, and corporate knowledge bases, query response latencies of 50–200ms are perfectly acceptable.
Object Storage Native: By designing for website search, we can load index files (
.hnswand.idx) and Parquet row groups on-demand from object storage (like S3/RustFS) or local disk cache. This enables an extremely cheap, serverless, scale-to-zero operational model.
Step 1: Production Readiness & Quality Validation¶
Before implementing new features, we must establish a production-readiness baseline. This ensures the engine’s core is secure, stable, and conforms to standard best practices.
1.1 Code Quality & Safety Checks¶
Security Audit: Ensure
cargo auditruns successfully in CI/CD with zero unignored vulnerabilities.Static Analysis: Enforce Clippy linting (
cargo clippy --all-targets --all-features) with zero warnings or errors.Formatting Standards: Verify that all Rust files are styled per
cargo fmt.Code Test Coverage: Ensure all Rust core unit and integration tests compile and run to completion (
cargo test --all-targets).Python Compatibility: Run the full Python test suite (
pytest) to ensure zero regressions in bindings, catalogs, and table reads/writes.
1.2 Documentation Readiness Check¶
API Reference Compilation: Verify that
cargo doc --no-depsbuilds cleanly without warnings or broken intra-doc links.Getting Started Guide: Ensure INSTALLATION.md is up-to-date with current APIs and dependency instructions.
API Coverage: Confirm all public catalog methods, index structures, and configuration keys are fully documented.
Step 2: Lexical Processing & Search Enhancements (Crate: benodb)¶
To support Elasticsearch-like search capability, we implement base lexical processing helpers within the core library.
2.1 Text Analyzers & Tokenizers¶
New Module:
src/core/index/analyzer.rsFeatures:
Lowercase filter.
Standard whitespace/punctuation tokenizer.
Basic english stop-word filter.
2.2 BM25 Relevance Scoring¶
Implementation: Calculate Okapi BM25 scores during inverted index lookup: $$\text{Score}(D, Q) = \sum_{i=1}^{n} \text{IDF}(q_i) \cdot \frac{f(q_i, D) \cdot (k_1 + 1)}{f(q_i, D) + k_1 \cdot \left(1 - b + b \cdot \frac{|D|}{\text{avgdl}}\right)}$$
Integration: Integrate the scoring mechanism with the search planner to rank results.
Step 3: The benodb-search Add-On Crate¶
Create a new package benodb-search in the Cargo workspace root.
3.1 Cargo Setup¶
New Crate: [benodb-search/Cargo.toml]
Dependencies:
benodb,axum,tower,tower-http,tokio,serde,serde_json.
3.2 Document Ingestion & Schema Evolution¶
Endpoint:
POST /<index_name>/_docDynamic Schema-Mapping: Parse arbitrary JSON documents, infer field datatypes, and dynamically evolve the target Iceberg schema (without rewriting existing Parquet data).
Buffered Commits: Route incoming documents to the active Memtable and Write-Ahead Log (WAL) to ensure low write latency.
3.3 Search API¶
Endpoint:
POST /<index_name>/_searchQuery Parser: Parse JSON-based query DSL matching standard search criteria:
match(lexical search using inverted index + BM25).knn(HNSW vector search).filter(roaring bitmap scalar pre-filtering).
On-Demand Loading: Fetch the HNSW and inverted indexes from S3/RustFS on-demand, caching them locally in temp storage for future requests.
Step 4: Verification & Benchmarking¶
4.1 Automated Validation¶
Implement a test suite in
benodb-search/tests/test_search_api.pythat verifies:Document ingestion via HTTP
POST.Dynamic table creation and schema evolution.
Hybrid lexical + vector search queries.
4.2 Benchmark Analysis¶
Measure ingestion throughput (docs/sec) and search latency (p95/p99) against a baseline local Elasticsearch instance, targeting the 50–200ms latency envelope.
Step 5: Positioning: Strengths & Weaknesses vs. Elasticsearch¶
To effectively market this add-on, we must clearly define how it compares to Elasticsearch (ES) so users understand when to choose BenoDB-Search.
5.1 Strengths (Competitive Advantages)¶
Ultra-Low TCO (Total Cost of Ownership):
Elasticsearch: Requires expensive instance groups with huge memory allocations (JVM heaps) and fast, hot SSD storage.
BenoDB: Built for serverless object storage (S3/RustFS). When idle, it costs nothing. Index files (
.hnswand.idx) are fetched on-demand and cached locally.
Open Data Lakehouse Integration:
Elasticsearch: Uses a proprietary data format. Getting data out for analysis requires heavy ETLs or expensive scroll APIs.
BenoDB: Underpinned by Apache Iceberg and Parquet. Other tools (DuckDB, Trino, Spark) can query the exact same files directly in the data lake without moving data.
Dynamic Schema Evolution:
Elasticsearch: Changing mapping types or structures often requires creating a new index and running a resource-heavy
_reindexjob.BenoDB: Inherits Iceberg’s native schema evolution, allowing column additions, drops, and renaming instantly.
GPU-Accelerated Hybrid Search:
Elasticsearch: Vector search runs on standard JVM threads.
BenoDB: Native vector indexing with SIMD/GPU acceleration for low-cost, high-scale HNSW execution.
5.2 Weaknesses (Where ES Wins & How to Position It)¶
Sub-Millisecond Query Latency:
Elasticsearch: Sub-5ms response times due to aggressive in-memory caching.
BenoDB: 50–200ms response times due to S3-native fetch overhead.
Positioning: Position BenoDB-Search for website search, document catalogs, and log archives where 50–200ms is imperceptible to users, but the 90% hosting cost reduction is highly compelling.
Ecosystem & Dashboarding:
Elasticsearch: Has mature Kibana integration for visualization and dashboarding.
BenoDB: No proprietary visualization frontend.
Leveraging Grafana, Prometheus & Apache Superset:
Prometheus Metrics Endpoint: The
benodb-searchREST server will expose a/metricsendpoint (via theprometheuscrate, already a dependency) providing operational telemetry: query latency histograms, ingestion throughput counters, index cache hit rates, and active connection gauges.Grafana + Prometheus Stack: Grafana natively scrapes Prometheus endpoints, giving operators real-time operational dashboards (query p95/p99, error rates, ingestion backpressure) out of the box with zero custom code.
Grafana via DuckDB / Trino (Data Dashboards): For data-level dashboards, Grafana connects to DuckDB and Trino. Since our tables are standard Iceberg, Grafana can query and visualize BenoDB data with full SQL support.
Apache Superset: The premier open-source BI tool for data lakes natively supports Trino, Spark, and DuckDB, offering a robust Kibana-like log viewing and dashboarding experience.
Elasticsearch API Compatibility: By ensuring our REST API matches standard Elasticsearch query endpoints, users can configure Grafana’s built-in Elasticsearch datasource to query BenoDB directly, providing zero-friction dashboard reuse.