Polyscope - The agent-first dev environment for Laravel

Elastic Scout Driver

babenkoivan/elastic-scout-driver image

Elastic Scout Driver stats

Downloads
1.4M
Stars
223
Open Issues
0
Forks
29

View on GitHub →

Elasticsearch driver for Laravel Scout

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.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Babenkoivan Elastic Scout Driver Related Articles

Building fast, fuzzy site search with Laravel and Typesense image

Building fast, fuzzy site search with Laravel and Typesense

Read article
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel
Acquaint Softtech logo

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
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech
Shift logo

Shift

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

Shift