Personal project
PulseSearch
Search over data that never stops changing. Every write to MySQL streams into Elasticsearch through change data capture. Elasticsearch serves keyword and vector search together, plus an AI assistant on Groq that answers only from what search finds. The whole pipeline starts with docker compose up. The app also ships as Kubernetes manifests, and GitHub Actions lints, tests, scans and publishes the images. Embeddings run locally, so there are no paid cloud services.
The problem
Most "AI search" demos sit on top of data that never changes. Real products don't work that way.
In production, data keeps changing and the search index has to keep up. Writes land in the main database, and search should show them within seconds, not the next morning. It also has to stay correct when messages are retried, services restart or events arrive out of order. On top of that, people expect results that understand meaning, and an assistant that answers from the latest data instead of making things up.
I wanted to build the whole system myself (streaming ingestion, change data capture, ranking, live updates and retrieval-augmented generation) as one pipeline I could monitor, and prove it works with real numbers.
The approach
PulseSearch treats MySQL as the source of truth. Every row change streams into Elasticsearch, which serves hybrid search and the AI assistant on top of that live index. The input is real: Wikipedia's live edit stream. Data flows all the time instead of coming from a fixed demo set.
- Change data capture, not polling. Debezium reads the MySQL binlog and publishes each change, in order, to Kafka (Redpanda). A worker creates an embedding for each change and writes it to Elasticsearch. Wikipedia summaries are fetched after indexing, so they don't slow down how fast a change becomes searchable.
- Hybrid search with RRF. Keyword results (BM25) and vector results (kNN) are combined in code with Reciprocal Rank Fusion. This avoids paid Elastic features and keeps the ranking easy to see and adjust. A labelled test script measures search quality on live data.
- An assistant that sticks to the facts. Groq's free
llama-3.1-8b-instantanswers only from the documents search returns. It cites sources with timestamps, says which one is newest, and refuses to answer when nothing is found. If the API is down, a simpler fallback pulls the answer straight from the documents. - Easy to monitor. Time from database commit to searchable, throughput and the failed-message rate are all Prometheus metrics, shown as p50, p95 and p99 in Grafana.
- Ready to deploy. Docker Compose is still the one-command demo. The app services also run on Kubernetes with health checks, a ServiceAccount and Ingress. CI runs Ruff, Bandit, unit tests, an Elasticsearch smoke test, the web build and kubeconform, then publishes images to GHCR from
main.
Architecture
In action



The hard parts
Each change applied once, even when messages repeat
Kafka offsets are saved only after a batch is safely written to Elasticsearch. Each write is version-checked using Debezium's ts_ms timestamp (version_type=external_gte). So a repeated or late message can never replace a document with an older version. A replay of 100K events produced zero duplicates.
Rebuild from the log, set bad messages aside
Kafka keeps the full change history, so rebuilding the index is a replay of the log, not a full reindex that hits the database hard. Messages that can't be read, or keep failing, go to a dead-letter topic so they don't block the stream.
Ranking that is free and easy to inspect
Elastic's built-in RRF needs a paid plan, so I combine the keyword and vector lists in code (k = 60). Every result shows both ranks, so it's clear why it ranked where it did, and it's easy to tune.
Keeping the main path fast
Fetching Wikipedia summaries before indexing slowed everything down. Now they are fetched after the document is searchable. Changes reach search quickly, and the summaries still arrive a moment later.
Keeping the assistant honest
The assistant answers only from what search returns. It cites sources with timestamps, and returns grounded: false when nothing was found. The model sits behind an LLMClient interface with a simple fallback, so the demo still works when the API is down.
Engineering
The code is split into layers so each part can be swapped and tested on its own. A shared core handles config, models, embeddings, Elasticsearch access and metrics. Data sources, embeddings and the LLM client sit behind Protocol interfaces (the Strategy pattern). A Repository layer keeps SQL and search queries out of the business logic. An anti-corruption layer turns raw Debezium messages into clean events. Unit tests cover the core, the Debezium adapter and the RRF ranking without any external services. CI adds a live Elasticsearch smoke test, plus Ruff and Bandit on every pull request.
CI/CD and Kubernetes
- GitHub Actions. Ruff lint and format, Bandit (medium severity and up), pip-audit (advisory only), unit tests, the Elasticsearch smoke test, Next.js lint and build, kustomize and kubeconform, then Docker Buildx for the api, worker, ingest and web images.
- Deploys from
main. The same images are published toghcr.io/shubhamsinha1010/pulsesearch-cdc-rag/{api,worker,ingest,web}, tagged:latestand:sha-<short>. - Kubernetes. Deployments with resource limits, HTTP health checks (the API's
/health/readyreturns 503 when Elasticsearch is down), a ServiceAccount that doesn't mount its token automatically, and host-based Ingress. A kustomize overlay points at the published images.
Outcome
Measured on my laptop with Docker and about 38k Wikipedia change documents, not in a cloud production setup. Keyword-only search is much cheaper (p50 about 27 ms). Most of the hybrid search time goes into creating the query embedding.
- 1.1 / 2.0 sfrom a database change to search, p50 / p95
- 310 mshybrid search p50 (warm); p95 1.6 s
- ~5/sdocuments indexed (peak ~6/s); AI answers in 0.8 to 1.0 s; almost no failed messages
Stack
FastAPIDebeziumKafka / RedpandaMySQLElasticsearchsentence-transformersGroqNext.jsPrometheusGrafanaDocker ComposeKubernetesGitHub ActionsGHCRRuffBandit