Package

Babenkoivan Elastic Scout Driver

Elasticsearch driver for Laravel Scout

Package

babenkoivan/elastic-scout-driver

View on GitHub →

Elastic Scout Driver for Laravel Scout


The Elastic Scout Driver is a Laravel package designed to integrate Elasticsearch with Laravel Scout, enhancing your Laravel application with powerful search capabilities.

Key Features:

  • Compatibility with Multiple Versions: Supports PHP 7.4-8.x, Elasticsearch 8.x, Laravel 7.x-10.x, and Laravel Scout 7.x-10.x.
  • Simple Installation: Easily installable via Composer and requires Laravel Scout to be set up first.
  • Flexible Configuration: Utilizes babenkoivan/elastic-client for setting up Elasticsearch client configurations. Also allows immediate document indexing with the refresh_documents configuration.
  • Basic to Advanced Usage: Supports basic search functionalities using Elasticsearch query strings and offers advanced search capabilities through the Elastic Scout Driver Plus extension.
  • Elasticsearch Migrations Support: Similar to Laravel's database migrations, Elastic Migrations help manage Elasticsearch index schema changes across environments.
  • Unique Handling of Searchable Data: Unlike other Scout drivers, the Elastic driver indexes models even if toSearchableArray returns an empty array, with customizable behavior.

Installation and Setup:

  1. Install via Composer:

    composer require babenkoivan/elastic-scout-driver
    composer require laravel/scout
    
  2. Publish and configure Scout settings:

    php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
    

    Set the driver option in config/scout.php to elastic.

  3. Publish and adjust client configuration as needed:

    php artisan vendor:publish --provider="Elastic\Client\ServiceProvider"
    

Usage:

  • Perform searches using a mini-language syntax or a match-all query:
    $orders = App\Order::search('title:(Star OR Trek)')->get();
    $orders = App\Order::search()->where('user_id', 1)->get();
    
  • For advanced search functionalities, consider using Elastic Scout Driver Plus for features like compound queries and custom filters.

Notes:

  • Be aware of the unique behavior in indexing and searching, especially regarding the handling of shouldBeSearchable and raw search results.
  • For Lumen users, specific installation instructions are provided in the package documentation.

This package extends Laravel Scout's capabilities, allowing for full-text search and more complex search queries using Elasticsearch, making it an essential tool for applications requiring efficient searching mechanisms.

Babenkoivan Elastic Scout Driver Related Articles

Learn how to use the TNTSearch driver with Laravel Scout image

Learn how to use the TNTSearch driver with Laravel Scout

Read article
Elastic Bridge: Eloquent-Style Queries for Elasticsearch and OpenSearch image

Elastic Bridge: Eloquent-Style Queries for Elasticsearch and OpenSearch

Read article
A practical guide to search Eloquent relationships using Laravel Scout Database Driver image

A practical guide to search Eloquent relationships using Laravel Scout Database Driver

Read article
Monolithic Application Performance Monitoring with Scout image

Monolithic Application Performance Monitoring with Scout

Read article
Getting started with Laravel Scout and Meilisearch image

Getting started with Laravel Scout and Meilisearch

Read article
ElasticSearch Driver for Laravel Scout image

ElasticSearch Driver for Laravel Scout

Read article

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift