Skip to content

pg_bleve

PostgreSQL extension for Bleve search integration

pg_bleve · PostgreSQL extension for Bleve search integration

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101043pg_blevepg_bleve1.0.0FTSAGPL-3.0Go

PostgreSQL · 17

Relationships
Requiresplpgsql

Usage

Sources:

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

CREATE EXTENSION pg_bleve;

SELECT bleve_create_index('products');

SELECT bleve_index_document(
    'products',
    'sku-42',
    '{"title":"Wireless headphones","category":"electronics"}'
);

SELECT bleve_search('products', 'category:electronics');
SELECT 'products' @@@ 'title:wireless';

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.

Table reader