Caches and copies Recommended
Keep search indexes in step
Update the search index from the source of truth through a reliable queue, and rebuild it fully on a schedule.
How to do it
Write index updates to an outbox table in the same transaction as the change, as the outbox rule describes. A worker applies them. A periodic full rebuild repairs anything that drifted.
How to check
Delete a product. Within the stated delay it disappears from search, and a full rebuild finds no differences.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers data playbook: https://agentwranglers.se/playbook/data/caches-and-copies/search-index-sync.