pg_bleve
pg_bleve · PostgreSQL extension for Bleve search integration
Overview
PostgreSQL · 17
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
- Official pg_bleve README
- Version 1.0.0 extension SQL
- Go implementation
- PostgreSQL index access-method wrapper
pg_bleve is an early PostgreSQL 17 experiment that calls the Go Bleve search library through cgo. Its functional surface is a set of manual index-management functions backed by files in /tmp/pg_bleve_indexes; the declared PostgreSQL bleve index access method is only a nonfunctional skeleton and does not maintain a searchable SQL index.
Manual indexing workflow
bleve_create_index(index_name, config_json) creates an on-disk Bleve index, but this release ignores config_json. bleve_index_document(index_name, doc_id, document_json) inserts or replaces one JSON document. bleve_search(index_name, query_string) returns search results as JSON text and hard-codes a maximum of ten hits.
The @@@ operator performs a direct query. ||| combines whitespace-separated terms as a disjunction, and &&& combines them as a conjunction. bleve_populate_index(index_name, table_name) serializes table rows but processes at most 1,000 rows; bleve_populate_index_batch(index_name, table_name, batch_size) is the experimental batch variant. Verify actual counts and results after either helper.
Critical limitations
Do not rely on CREATE INDEX ... USING bleve. In this revision the build callback creates an empty external index without indexing heap tuples, the insert callback does no indexing, scans return no tuples, and vacuum callbacks do no maintenance. PostgreSQL updates and deletes are therefore not synchronized automatically.
The Bleve files are outside PostgreSQL transactions, MVCC, WAL, backup, recovery, and privilege enforcement. /tmp may be cleared, index names are used in filesystem paths, and names can collide across databases or clusters on the same host. Several side-effecting or filesystem-reading functions are also declared IMMUTABLE, which does not match their behavior. Treat the extension as disposable lab code only; never infer database durability or consistency from a successful function call.