Bleve

A modern Go library for full-text, numeric, geospatial, and vector search and indexing.

Library
Go
vv2.6.1
11,198stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
88/100Excellent
Development Activity88
Maintenance80
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
84/100Excellent
Architecture88
Code Quality87
Innovation82
Learning Curve80

Bleve is an open-source Go library that brings full-text, numeric, geospatial, and vector indexing and search into any Go application without an external search server. It exposes a small, idiomatic API — index a struct or JSON document with a mapping, then run term, phrase, fuzzy, range, boolean, or approximate k-nearest-neighbor vector queries against it, with TF-IDF or BM25 scoring, result highlighting, and terms/range/date facets built in.

Under the hood, Bleve ships a pluggable storage layer (the scorch segment-based index is the default, alongside an upsidedown store and Moss/BoltDB-backed options) and a configurable analysis pipeline with tokenizers, stemmers, and stop-word lists for over 30 languages. It also supports hybrid search that fuses exact and semantic (vector) results via Reciprocal Rank Fusion or Relative Score Fusion, plus synonym search and hierarchical/nested-document queries. A bundled bleve CLI can create, inspect, and query indexes directly from the terminal.

What You Get

  • An embeddable index (bleve.New/bleve.Open) backed by the scorch segment-based storage engine, with upsidedown and Moss/BoltDB alternatives available via the pluggable registry
  • A rich query language: term, phrase, match, prefix, regexp, wildcard, fuzzy, term/numeric/date range, boolean field, and compound conjunction/disjunction/boolean queries, plus a Google-like query string syntax
  • Approximate k-nearest-neighbor vector search with hybrid fusion (RRF and RSF) to combine exact and semantic results in one ranked list
  • Configurable text analysis with tokenizers, stemmers (Snowball, Porter, Stempel), and language-specific analyzers for 30+ languages, plus synonym search support
  • Built-in faceting (terms, numeric range, date range), result pagination, query-time boosting, and match highlighting with document fragments
  • A standalone bleve CLI (go install github.com/blevesearch/bleve/v2/cmd/bleve@latest) for creating, bulk-loading, inspecting, and querying indexes without writing Go code

Common Use Cases

  • Adding full-text search to a Go web application or API without standing up Elasticsearch, OpenSearch, or Meilisearch
  • Building embedded/offline search for CLI tools, desktop apps, or edge deployments where an external search cluster isn’t practical
  • Combining keyword and vector (semantic) search in a single hybrid query for RAG or AI-assisted search features
  • Geospatial search over point/shape data alongside text and numeric filters in one index
  • Indexing structured records with nested/hierarchical relationships (arrays of objects) while preserving parent-child structure in queries

Under The Hood

Architecture Bleve’s public API (index.go, index_impl.go, query.go) is a thin facade over a pluggable index.Index implementation resolved through the registry package, so the top-level indexImpl struct in index_impl.go only orchestrates mapping, mutex-guarded open/close state, and stats while delegating storage to whichever backend is registered — scorch (index/scorch) by default, with upsidedown (index/upsidedown) and Moss/BoltDB-backed stores also available. Indexing flows through document.Document/mapping.IndexMapping (Batch.Index in index.go calls Mapping().MapDocument before handing an internal index.Batch to the store), while querying flows through search/query types compiled into searchers and merged by search/collector, with rescorer.go and fusion/ (RRF, RSF) layered on top for combining exact and k-NN vector results. This clean separation between mapping, storage, and query execution means a new storage engine or query type can be added without touching the public API surface.

Tech Stack Bleve targets Go 1.25+ and depends on a family of sibling blevesearch modules for its storage and analysis internals — zapx (v11–v17, the on-disk segment format for scorch), scorch_segment_api, vellum (finite-state transducers for term dictionaries), upsidedown_store_api, geo (geospatial indexing), go-faiss (approximate nearest-neighbor vector search), and stemmer packages (snowball, snowballstem, go-porterstemmer, stempel). It also pulls in RoaringBitmap/roaring for compressed postings lists, go.etcd.io/bbolt and couchbase/moss as alternate storage backends, spf13/cobra for the bundled CLI, and google.golang.org/protobuf. CI (.github/workflows/tests.yml) runs go test -race ./... across Go 1.24–1.26 on Ubuntu, macOS, and Windows.

Code Quality The repository has an extensive test suite — 222 _test.go files across the root package and subpackages (mapping, search, index/scorch, etc.) — run with the race detector in CI on every push and pull request, plus a separate cover.yml workflow for coverage reporting. Code follows conventional Go idioms: exported types and functions carry doc comments, errors are returned as typed sentinel values (error.go defines package-level Errorxxx variables) rather than swallowed, and the size package tracks memory accounting for cache-conscious data structures. A 16-line CONTRIBUTING.md keeps the contribution bar low, and a SECURITY.md documents a vulnerability-disclosure process.

API Design The public API is deliberately small and consistent: bleve.NewIndexMapping() / bleve.New() / bleve.Open() to set up storage, index.Index() / Batch.Index() to add documents, and a family of bleve.NewXxxQuery() constructors (NewBooleanQuery, NewMatchQuery, NewDateRangeQuery, etc.) that all return one composable query.Query interface consumed by NewSearchRequest. Getting from zero to a working index-and-search round trip takes under 10 lines, as shown directly in the README, and the query constructors avoid requiring users to understand the underlying storage or scoring model to get started. Documentation is spread across a docs/ directory with dedicated guides for geo search, pagination, hierarchy, synonyms, and score fusion, plus a hosted text-analysis wizard for experimenting with analyzers interactively.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search