Skip to content
Projekte

Über uns

Apache-2.0 Rust search engine. S3 is the source of truth, NVMe is a cache, compute is disposable. BM25, kNN, and hybrid search with an Elasticsearch-shaped API.

Daten und Analyse

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
Verlauf wird gesammelt
in 7 days
Verlauf wird gesammelt
in 15 days
Verlauf wird gesammelt
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Kosha

CI License

Apache-2.0 search engine in Rust. S3 is the source of truth, local NVMe is a cache, and compute nodes are disposable. BM25, kNN, and hybrid search behind an Elasticsearch-shaped API.

DecoverAI built Kosha to replace Elasticsearch. It is not a faster Lucene cluster. Durable segments live in object storage, a query node is a cache in front of that bucket, and losing a node means warming another cache. Idle data costs storage bytes, not a hot shard.

Architecture: DESIGN.md. What the server actually promises, and what it does not: docs/guarantees.md.

Using Claude Code or Codex? Connect to managed Kosha Cloud in one command: Kosha Cloud quickstart.

Benchmarks: BM25 at 10M documents

Same 10M MS MARCO passages, same single m7i.8xlarge, same open-loop client at 8 QPS, top 10, ids only, 30 minutes per phase. Every phase: 14,401 requests, 0 errors, 0 zero-hit queries. Client-side latency in ms. Kosha and Lance read from S3; OpenSearch and Elasticsearch hold the whole index on local disk.

Engine Data Phase p50 p90 p99
Kosha 10M · S3 result cache off 13.8 23.7 36.3
Kosha 10M · S3 result cache on 2.1 9.8 24.5
OpenSearch 3.10.1 * 10M · local disk caches off 6.6 8.6 10.7
OpenSearch 3.10.1 * 10M · local disk defaults 6.4 8.4 10.6
Elasticsearch 9.5.7 10M · local disk caches off 6.4 9.8 13.3
Elasticsearch 9.5.7 10M · local disk defaults 6.4 9.7 13.2
Lance 14.0.3 + Iceberg 10M · S3 warm 41.2 68.9 116.9
Lance 14.0.3 + Iceberg 10M · S3 cold first pass 109.2 173.1 362.8
Turbopuffer † 1M · published warm 13 18 29
Turbopuffer † 1M · published cold 316 381 559

With its result cache off, Kosha's median is about 2× behind the Lucene engines. That's the gap we're closing. OpenSearch and Elasticsearch don't cache top-10 hit lists, so their "defaults" rows match "caches off".

* Measured on an index that wasn't fully merged (175 segments instead of 8); a rerun is pending.

† Turbopuffer's own published figures: 1M docs, conditions not stated. Not like-for-like.

Runs: Kosha 46119479389, OpenSearch 46225911925, Elasticsearch 46230873683, Lance 46238888714. How each engine was run, the caveats, and the commands to reproduce: docs/benchmarks.md. Vector (kNN) search has no cross-engine comparison yet.

Why it exists

Elasticsearch and OpenSearch fuse compute and storage. Every data node holds its shards, scaling queries means moving those shards, and an idle tenant still occupies heap and disk. Recovery is a cluster operation.

Kosha splits those roles. Segment files in S3 are the only copy that has to survive. Each process keeps a read-through NVMe cache. Adding a query node is starting a process near the bucket. The API is close to the Elasticsearch JSON that applications already send, translated by the Python client; it is not a full Query DSL. The gaps are listed in the compatibility matrix and under What is not supported yet.

60-second quickstart

The published image is decoverai/kosha (:latest and the version, e.g. :0.3.0, for releases, :main on every merge to main). The server refuses to start until it has an API key. This container keeps segments on its own disk and the catalog in memory: stop the container and the data is gone. For a durable self-hosted stack with generated credentials, use deploy/selfhost; for engine development, the development compose file.

docker run --rm -p 8080:8080 \
  -e KOSHA_API_KEY=sk-kosha-dev \
  -e KOSHA_ROLE=standalone \
  decoverai/kosha:latest

In another shell:

curl -s localhost:8080/healthz

curl -s -X POST localhost:8080/v1/namespaces/demo/documents \
  -H 'content-type: application/json' \
  -H 'authorization: Bearer sk-kosha-dev' \
  -d '{"documents":[
    {"id":"1","fields":[{"name":"title","field_type":"Text","value":"breach of contract"}]},
    {"id":"2","fields":[{"name":"title","field_type":"Text","value":"merger antitrust review"}]}
  ]}'

curl -s -X POST localhost:8080/v1/namespaces/demo/flush \
  -H 'content-type: application/json' \
  -H 'authorization: Bearer sk-kosha-dev' \
  -d '{}'

curl -s -X POST localhost:8080/v1/namespaces/demo/search \
  -H 'content-type: application/json' \
  -H 'authorization: Bearer sk-kosha-dev' \
  -d '{"query_text":"breach","max_results":10}'

The search body returns a results array. Each hit has doc_id and score.

From an application

Install an SDK, set KOSHA_HOST and KOSHA_API_KEY, and write ordinary documents. The same code runs against managed Kosha and a self-hosted server.

pip install kosha-client          # or: npm install @decover/kosha
                                  # or: go get github.com/decover-tech/kosha/clients/go
export KOSHA_HOST=http://localhost:8080 KOSHA_API_KEY=sk-kosha-dev
from kosha_client import F, Kosha

docs = Kosha().namespace("demo")
docs.upsert([{"id": "1", "title": "breach of contract", "status": "open"}])
print(docs.search("breach", filter=F.eq("status", "open"))["hits"])

No flush is needed before reading. TypeScript and Go are the same calls (clients/examples/quickstart); the contract is clients/SDK.md. For a durable self-hosted server that generates its credentials and writes them out for the SDKs, run deploy/selfhost/bootstrap.sh. The CLI walkthrough is docs/quickstart.md.

Vector search numbers

Kosha only; there is no matched cross-engine kNN run yet. 10M documents × 1024-d f32, k=10, num_candidates=100, warm, result cache on, 8 QPS, run 44876437446: p50 88.0 ms, p90 111 ms, p99 222 ms. Recall@10 against exact search on 100 queries: mean 0.90, median 1.0. Details and older runs: docs/benchmarks.md.

There is no measured "Nx cheaper than OpenSearch" result in this repo. DESIGN.md §16 prints per-GB planning figures and labels them as targets, not measurements.

Clients and docs

Server image Docker Hub decoverai/kosha docker pull decoverai/kosha:latest
Python PyPI kosha-client pip install kosha-client
TypeScript (preview) clients/typescript npm install @decover/kosha
Go (preview) clients/go go get github.com/decover-tech/kosha/clients/go
CLI not on crates.io yet cargo install --path crates/kosha-cli

Which image name is the one CI publishes, and why an older ravidecoverai/kosha tag still exists: docs/development.md.

Topic
Kosha Cloud quickstart (Claude Code & Codex) docs/cloud-quickstart.md
Feature reference (query, indexing, analyzers, vectors) docs/reference/features.md
HTTP API, including delete docs/reference/http-api.md
Elasticsearch / OpenSearch compatibility docs/compat/opensearch.md
Moving an index docs/migration/from-elasticsearch.md
Configuration docs/configuration.md
Guarantees and limits docs/guarantees.md
Authorization, WAL, upgrade order docs/reference/auth.md
Exports, schema changes docs/reference/exports.md, docs/reference/schema.md
Build, test, Docker, layout docs/development.md
How DecoverAI replaced Elasticsearch docs/blog/how-we-replaced-elasticsearch.md
Kubernetes k8s/README.md

Multi-tenant cells install from k8s/saas. A single-customer stack installs from k8s/base. Upgrades have to follow the manifest and WAL order in docs/reference/auth.md. See docs/deployment-model.md.

What works today

BM25 (including phrases, fuzzy, per-field boosts, and block-max WAND), filtered kNN, hybrid reciprocal rank fusion, filters, highlighting, a bounded set of aggregations, compaction, and a Postgres control plane. The tables, request shapes, and limits are docs/reference/features.md.

What is not supported yet

  • A full Elasticsearch Query DSL. script_score, query_string, nested documents, and a lot of the rest are rejected by the Python client rather than silently dropped. The matrix is docs/compat/opensearch.md.
  • gRPC. The proto describes it; HTTP/JSON is the transport that runs.
  • Several analyzer features: synonyms, n-grams, non-English stemmers, full Unicode case folding.
  • A namespace-level centroid index. Each segment still has its own vector postings.
  • The longer list, including rerank and fuzzy limits, is in docs/reference/features.md.

Contributing

See CONTRIBUTING.md.

License

Apache-2.0. See LICENSE.

Ähnliche Projekte entdecken

Wird geladen…