Drupal Solr Reindexing Workflow - Step by Step

Step-by-step reindexing guide

Typical Workflow: Reset Tracker + Parallel Indexing

The most common workflow is to reset the tracker and then start parallel indexing. Resetting the tracker queues all already-tracked items for re-indexing by setting their status to "needs indexing" in the search_api_item table. It does not rebuild or re-scan content — it simply marks every item the tracker already knows about as pending, so they will be picked up by the indexer on the next run.

# 1. Queue all items for reindexing on the server
drush osri --server=my_solr_server

# 2. Start parallel indexing (background by default)
drush ost --server=my_solr_server

# 3. Monitor progress
drush oss

# 4. Watch detailed log (optional)
tail -f /tmp/opensolr_turbo_my_solr_server.log
💡 osri vs osrb vs sapi-rt
  • drush osri (reindex) — Queues all items on a server for reindexing. Fast and safe. Handles all indexes on the server in one command. This is what you want most of the time.
  • drush sapi-rt (reset tracker) — Native Search API command. Same effect but only works on a single index at a time.
  • drush osrb (rebuild) — Heavier. Drops and re-scans all content to rebuild the tracker table from scratch. Use this only when the tracker itself is out of sync (wrong counts, missing items).

Alternative Workflow: Full Rebuild

Use this workflow only when the tracker is out of sync, showing incorrect counts, or after major content migrations / backup restores:

# 1. Rebuild trackers (re-scans all content)
drush osrb --server=my_solr_server

# 2. Start parallel indexing (background by default)
drush ost --server=my_solr_server

# 3. Monitor progress
drush oss

# 4. Watch detailed log (optional)
tail -f /tmp/opensolr_turbo_my_solr_server.log

Step-by-Step Guide

Step 1: Check Current Status

Before starting, see what needs to be indexed:

drush oss

This shows you:

  • Total items in each index
  • How many are already indexed
  • How many remain

Step 2: Queue Items for Reindexing

Queue all items on a server for reindexing. This marks every tracked item as "needs indexing" across all enabled indexes on the server:

drush osri --server=my_solr_server

Search continues working during reindexing since existing Solr data is preserved.

Step 3: Start Indexing

Start the indexer (runs in background by default):

drush ost --server=my_solr_server
💡 Choosing Workers and Batch Size
  • Workers: Start with your CPU count, adjust based on load
  • Batch: 500 is good for most sites; reduce if you have complex content

Step 4: Monitor Progress

Check progress periodically:

# Quick status check
drush oss

# Detailed live log (server-specific)
tail -f /tmp/opensolr_turbo_my_solr_server.log

Step 5: Verify Completion

When done, verify everything is indexed:

drush oss

All indexes should show 100% with 0 remaining items.

Quick Re-index

For a quick interactive re-index (small sites or testing):

# Reset tracker first, then index in foreground
drush sapi-rt my_solr_index
drush ost --index=my_solr_index --workers=4 --no-background

Single Index

To index just one specific index:

drush osri --index=my_solr_index
drush ost --index=my_solr_index

Multi-Server Parallel Workflow

Index production and staging simultaneously:

# Queue both servers
drush osri --server=production_solr
drush osri --server=staging_solr

# Start both (each runs as independent background session)
drush ost --server=production_solr
drush ost --server=staging_solr

# Monitor all sessions
drush oss

# Stop only staging if needed
drush osstop --server=staging_solr