Skip to content
SScout Redis Search
ESC

    Reference

    CLI Reference

    Laravel Scout commands for creating, importing, flushing, and deleting Redis Search indexes.


    The package uses Laravel Scout’s standard index commands. There are no package-specific Redis CLI commands to learn.

    Commands

    Command Description
    scout:index {name} Creates an index from the configured schema.
    scout:import {model} Imports existing Eloquent records.
    scout:flush {model} Drops and recreates the model’s configured index.
    scout:delete-index {name} Deletes a RediSearch index and its documents.

    Create and import

    php artisan scout:index users
    php artisan scout:import "App\Models\User"

    The {name} argument must match the model’s searchableAs() value and the corresponding key in config/scout-redis-search.php.

    Recreate after schema changes

    php artisan scout:delete-index users
    php artisan scout:index users
    php artisan scout:import "App\Models\User"

    FT.CREATE schemas are fixed when the index is created. Re-importing without recreating does not change an existing schema.

    Flush documents

    php artisan scout:flush "App\Models\User"

    This driver recreates the empty index after flushing so subsequent search() calls continue to have a valid index.

    Programmatic lifecycle checks

    The resolved engine exposes small lifecycle helpers for deployment scripts and integration tests:

    $engine = app(\Laravel\Scout\EngineManager::class)->engine('redis-search');
    
    $engine->indexExists('users');
    $engine->dropIndexIfExists('users');