Problem:
- Running elastic:rebuild --model=X failed when indexes already existed
- Migrations threw "index already exists" errors in production
- Command runs ALL migrations even when rebuilding single model
Solution:
- Added existence checks to all 12 migration files
- Migrations now skip creation if index already exists
- Safe to run multiple times without errors
Changes:
- Added ClientBuilder import to all migrations
- Check indices()->exists() before creating
- Return early if index already exists
- Removed force drop from recurring_invoices migration
Benefits:
- Production-safe partial rebuilds
- No "already exists" errors
- Idempotent migrations
- Clean log output
Files modified:
- All 12 files in elastic/migrations/*.php