Search and Elasticsearch · Scenario
A new product doesn't show up in search
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
A seller added a product an hour ago. It's on the product page, but search can't find it, and other sellers say the same. Our pipeline is Postgres, then Debezium into Kafka, then an indexer service that writes to Elasticsearch. Where do you look?
Then
Follow-ups the interviewer asks next
- Is the document in the index at all? How do you check?
- Where in the pipeline can it get stuck, and in what order do you check?
- Only some new products are missing. What does that tell you?
- You find one bad record blocking a partition. What do you do right now?
- After the fix, search shows old prices for some products. Why?
- How do you find every product that's out of sync?
- How do you stop this happening again?
The answer
What a strong answer covers
- Check the index:
GET products/_doc/<id>. If it's missing, walk the pipeline backwards: indexer errors and consumer lag per partition, the Kafka topic (is the change event there?), the Debezium connector's status, and the replication slot's lag in Postgres. - Some products missing plus lag on one partition means one partition is stuck: a "poison" record the indexer can't write is retried forever, blocking everything behind it. Products are keyed by id, so about 1 in 12 new products is stuck.
- Right now: move the bad record to a dead-letter topic, let the partition catch up, then fix and replay it. Watch Postgres disk too: a stalled Debezium slot makes WAL pile up.
- Root cause: a mapping conflict.
attributes.weightwas mapped as a number because the first product sent250; now a seller sent "250g". Use explicit types ("dynamic": "strict"), clean data in the indexer, and reindex. - Stale prices: replays applied older events after newer ones. Index with an external version (the row's version or the change's log position,
version_type: external) so older writes are rejected, or re-read the current row before indexing. - Reconcile: a job that compares ids and
updated_atbetween Postgres and the index and reindexes differences; run it now and daily. - Prevent: alerts on consumer lag per partition and on dead-letter counts, an end-to-end check (create a test product, find it in search within a minute), and price and stock read from the database at display time.
The red pen
Common traps
Avoid:"reindex everything" before finding the block; restarting the indexer (it hits the same record again); blaming the refresh interval without checking.
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.