تخطَّ إلى المحتوى

Search Plugin

هذا المحتوى غير متوفر بلغتك بعد.

The search plugin provides a unified search API across three backends. App code written against any one backend works with the others by changing one env var and restarting.

FeatureMeiliSearchTypesenseOpenSearch
Best forSmall deploys, low RAMMulti-tenant, teamsEnterprise, compliance
Multi-tenant isolationFilter-basedScoped API keysRole + filter
SchemaAuto-inferredSchema-first (auto on first batch)Dynamic mappings
Disk footprintLowMediumHigh
TLS in devOptionalOptionalOPENSEARCH_TLS_VERIFY=false
Bundlesearch ($0.99/mo)search ($0.99/mo)search ($0.99/mo)

All three share the same HTTP API surface on port 8050 (CS_3).

Terminal window
nself license set nself_pro_xxxx...
nself plugin install search
nself build

Set SEARCH_ENGINE to choose the active backend. All other vars for the inactive backends are ignored.

SEARCH_ENGINE=meilisearch
MEILISEARCH_URL=http://localhost:7700
MEILISEARCH_MASTER_KEY=your-master-key
SEARCH_ENGINE=typesense
TYPESENSE_HOST=localhost
TYPESENSE_PORT=8108
TYPESENSE_PROTOCOL=https
TYPESENSE_API_KEY=your-api-key
SEARCH_ENGINE=opensearch
OPENSEARCH_URL=https://localhost:9200
OPENSEARCH_USERNAME=admin
OPENSEARCH_PASSWORD=your-password
# Dev only, allows self-signed certificate:
OPENSEARCH_TLS_VERIFY=false

All routes are prefixed /search and served by the plugin on port 8050.

MethodPathDescription
GET/search/statusBackend type, version, stats
GET/search/indexesList all indexes
POST/search/index/:name/documentsUpsert documents
DELETE/search/index/:name/documents/:idDelete a document
POST/search/index/:name/queryFull-text search
POST/search/index/:name/schemaCreate or update index schema
POST /search/index/products/documents
[{"id": "1", "title": "Widget", "price": 9.99}]
POST /search/index/products/query
{"query": "widget", "limit": 20, "highlight_fields": ["title"]}
{
"backend": "typesense",
"version": "0.25.2",
"indexes": 4,
"extra": {"ok": true}
}

When using SEARCH_ENGINE=typesense, the plugin reads the X-Hasura-Role request header and generates a Typesense scoped API key that restricts results to documents tagged with that role. Queries from different roles cannot see each other’s documents within the same collection.

Changing SEARCH_ENGINE and restarting the plugin triggers a full reindex from Postgres (np_search_documents table). The reindex runs automatically on startup, no manual intervention required.

The search plugin is wired into Hasura under the search namespace. Queries use the same search namespace regardless of the active backend.

On startup the plugin applies:

ALTER TABLE np_search_indexes
ADD COLUMN IF NOT EXISTS backend TEXT NOT NULL DEFAULT 'meilisearch';

This is idempotent and safe to run repeatedly.