Search Configuration

v0.4.8Updated for nself v0.4.8

nself supports 6 search engines with the nself search command. Choose the right engine for your use case - from zero-config PostgreSQL full-text search to advanced engines like Elasticsearch.

Search Commands

CommandDescription
nself searchShow help
nself search enable [--engine <name>]Enable search service
nself search disableDisable search service
nself search statusShow search service status
nself search test [query]Test search functionality
nself search reindexRebuild search index
nself search configureConfigure search settings
nself search setupInteractive setup wizard

Supported Search Engines

EngineBest ForMemory
PostgreSQL FTSSimple full-text, zero extra services~0 (uses existing DB)
MeiliSearchTypo-tolerant, instant results100-500MB
TypesenseFast, typo-tolerant search100-500MB
ElasticsearchComplex queries, analytics1-4GB
OpenSearchElasticsearch alternative (AWS)1-4GB
SonicLightweight, fast ingestion50-100MB

Quick Start

PostgreSQL Full-Text Search (Default)

No additional services needed - uses your existing database:

# Enable PostgreSQL FTS (default, recommended for most projects)
nself search enable --engine postgres

# Test search functionality
nself search test "hello world"

MeiliSearch (Typo-Tolerant)

Great for user-facing search with typo tolerance:

# Enable MeiliSearch
nself search enable --engine meilisearch

# Rebuild to add the MeiliSearch container
nself build && nself start

Typesense (Fast & Lightweight)

# Enable Typesense
nself search enable --engine typesense

# Rebuild
nself build && nself start

Configuration

Search engine settings in your .env file:

# Search Engine Selection
SEARCH_ENGINE=postgres    # or: meilisearch, typesense, elasticsearch, opensearch, sonic

# MeiliSearch Settings (when enabled)
MEILISEARCH_MASTER_KEY=your-master-key-minimum-32-chars
MEILISEARCH_HOST=meilisearch
MEILISEARCH_PORT=7700

# Typesense Settings (when enabled)
TYPESENSE_API_KEY=your-api-key
TYPESENSE_HOST=typesense
TYPESENSE_PORT=8108

# Elasticsearch/OpenSearch Settings (when enabled)
ELASTICSEARCH_URL=http://elasticsearch:9200
ELASTICSEARCH_USERNAME=elastic
ELASTICSEARCH_PASSWORD=your-password

Choosing the Right Engine

PostgreSQL FTS

Choose when: You want simplicity, already use PostgreSQL, and don't need typo tolerance. Zero additional memory overhead.

MeiliSearch or Typesense

Choose when: Building user-facing search (e-commerce, documentation, blogs) where typo tolerance and instant results matter.

Elasticsearch / OpenSearch

Choose when: You need complex queries, aggregations, analytics, geo-search, or are building an enterprise search solution.

Sonic

Choose when: Memory is extremely constrained but you still need basic search functionality.

Troubleshooting

Search Not Working

Run nself search status to check configuration. Ensure the search service is running with nself status.

High Memory Usage

Elasticsearch and OpenSearch require significant memory. Consider MeiliSearch, Typesense, or PostgreSQL FTS for smaller deployments.

Index Not Found

Run nself search reindex to rebuild indices after schema changes.

Recommendations

  • Simple sites: PostgreSQL full-text search
  • E-commerce: MeiliSearch or Typesense
  • Complex analytics: Elasticsearch
  • Resource constrained: Sonic
  • AWS environment: OpenSearch