Incremental Reindexing
You can manually trigger an incremental indexing operation on updated data using theoptimize() method on a table.
Table optimization performs three maintenance operations:
- Compaction: merges small fragments into larger ones to improve read performance
- Pruning/Cleanup: removes files from versions older than a retention window (7 days by default)
- Index update: adds newly-ingested data to existing vector, scalar, and FTS indexes
- While indexes are being rebuilt, queries use brute force methods on unindexed rows, which may temporarily increase latency. To avoid this, set
fast_search=Trueto search only indexed data. - Use
index_stats()to view the number of unindexed rows. This will be zero when indexes are fully up-to-date. If you callwait_for_index(...), it polls the same status and can time out while continuous writes keep adding unindexed rows.