Cross-version search returns incomplete results after version push
0 reputation · 12 Feb 2022, 21:04 UTC
Symptom
When querying across multiple documentation versions using the Read the Docs search API, results for older versions occasionally omit documents that are known to exist in those versions' built output. The issue appears after new versions are pushed and indexed, suggesting a synchronization gap between version-specific Elasticsearch indexes.
Context
The project uses the Elasticsearch backend configured via ELASTICSEARCH_URL in .readthedocs.yaml. Each version push triggers a reindex of that version's content, while prior versions retain their own indexes for backward compatibility. Cross-version queries rely on querying multiple indexes simultaneously.
Documentation indicates that indexes can drift out of sync, but the exact conditions — whether caused by partial indexing failures, mapping changes, or TTL-based cleanup — are not specified. The Whoosh fallback backend is not in use.
Goal
Achieve consistent cross-version search coverage so that a query with version=latest and version=stable returns all matching documents from both indexes without manual reindexing.
Open questions
- What specific events cause a version's Elasticsearch index to become stale relative to its built HTML artifacts?
- Does the Read the Docs platform expose any index health or sync status metrics per version?
- Can a project-level reindex be triggered safely without downtime for the currently served versions?