Skip to content
SScout Redis Search
ESC

    Getting Started

    Installation

    Install Scout Redis Search, connect Redis Stack, and create your first index.


    Requirements

    Component Minimum version
    PHP 8.2
    Laravel 10.x
    Laravel Scout 10.x
    Redis RediSearch module

    The Redis server must provide FT.CREATE and FT.SEARCH. Redis Stack is the recommended local setup; plain Redis without RediSearch is not enough.

    Start Redis Stack

    services:
      redis:
        image: redis/redis-stack:latest
        ports:
          - "6379:6379"
          - "8001:8001"
        volumes:
          - redis-data:/data
    
    volumes:
      redis-data:
    docker compose up -d

    RedisInsight is available at http://localhost:8001.

    Install with Composer

    composer require laravel/scout predis/predis burak-sevinc/scout-redis-search

    The package registers itself through Laravel package auto-discovery. Publish the configuration file:

    php artisan vendor:publish --tag=scout-redis-search-config

    This creates config/scout-redis-search.php. Laravel Scout also has its own config/scout.php file. They have separate responsibilities:

    File Responsibility
    config/scout.php Selects the Scout driver with SCOUT_DRIVER.
    config/scout-redis-search.php Configures this package’s Redis connection, document keys, prefix matching, and schemas.

    Enable the driver

    Switch Scout and the Redis client in .env:

    SCOUT_DRIVER=redis-search
    REDIS_CLIENT=predis
    REDIS_HOST=127.0.0.1
    REDIS_PORT=6379
    
    SCOUT_REDIS_SEARCH_CONNECTION=default
    SCOUT_REDIS_SEARCH_PREFIX=scout:
    SCOUT_REDIS_SEARCH_SEPARATOR=:

    The search connection can be any connection defined in config/database.php. Leaving SCOUT_REDIS_SEARCH_CONNECTION empty uses Laravel’s default Redis connection.

    Verify the module

    Confirm that RediSearch is loaded:

    docker exec scout-test-redis redis-cli MODULE LIST

    Look for a module whose name is search. A plain Redis container will not list it and will fail when the package sends FT.CREATE.

    Continue with Configuration to define a schema.