Recipes
Task-oriented AI & search recipes for building real things with XERJ — retrieval by meaning, agent memory, hybrid ranking, log analytics, and anomaly detection. Each recipe was verified end-to-end against a live XERJ before it was written, and ships with a runnable, dependency-free example.
Retrieval by meaning with semantic_text — auto-embed on ingest, no separate vector DB.
A memory-backed agent on the /_memory API — store, semantic + keyword recall, metadata filters, forgetting, per-agent isolation.
semantic_text auto-embeds every overlapping passage; a long doc competes on any one of its sections via best-passage (max-sim) scoring — 98% top-3 vs 32% pooled.
Nearest-neighbor similarity search over dense_vector (HNSW), with filters.
Opt a dense_vector field into scalar8 (int8_hnsw) — 4× smaller vectors, recall@10 ≈ 0.99.
Keyword + vector in one query — results neither BM25 nor kNN finds alone.
07 Log analyticsFrom raw logs to dashboards — error rates, p95 latency, top services via aggregations.
08 Anomaly detectionStatistical _ml detectors that flag spikes in metrics/logs.
A live _ml datafeed that re-scores an index on a timer and stores new anomaly records you poll.
Point your existing ES client at XERJ — same wire, change the URL.
11 Index a folder of PDFs, Word docs & web pagesOne xerj-index pass walks a recursive folder of PDF/DOCX/HTML/MD/TXT, extracts + chunks + auto-embeds every file, then lexical, semantic & hybrid search return ranked, cited passages — measured 21/22 vs a fair grep baseline's 14/22, with the decisive win on binary_only (6/7 vs 0/7) because grep can't read a PDF/DOCX.