babenkoivan / elastic-scout-driver-plus by babenkoivan

Extension for Elastic Scout Driver
Package Data
Maintainer Username: babenkoivan
Maintainer Contact: (Ivan Babenko)
Package Create Date: 2020-02-15
Package Last Update: 2022-07-29
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2022-08-05 03:00:43
Package Statistics
Total Downloads: 434,565
Monthly Downloads: 26,954
Daily Downloads: 1,141
Total Stars: 196
Total Watchers: 6
Total Forks: 39
Total Open Issues: 4

Extension for Elastic Scout Driver.



Elastic Scout Driver Plus supports:


The current version of Elastic Scout Driver Plus has been tested with the following configuration:

  • PHP 7.2-7.4
  • Elasticsearch 7.0-7.9
  • Laravel 6.x-8.x
  • Laravel Scout 7.x-8.x
  • Elastic Scout Driver 1.x


The library can be installed via Composer:

composer require babenkoivan/elastic-scout-driver-plus

Note, that the library doesn't work without Elastic Scout Driver. If it's not installed yet, please follow the installation steps described here. If you are already using Elastic Scout Driver, I recommend you to update it before installing Elastic Scout Driver Plus:

composer update babenkoivan/elastic-scout-driver

If you want to use Elastic Scout Driver Plus with Lumen framework refer to this guide.


Elastic Scout Driver Plus comes with a new trait, which you need to add in your model to activate advanced search functionality:

class Book extends Model
    use Searchable;
    use CustomSearch;

This trait adds a bunch of factory methods in your model: boolSearch(), matchSearch(), rawSearch(), etc. Each method creates a search request builder for the specific query type. For example, if you want to make a match query use matchSearch() method:

$searchResult = Book::matchSearch()
    ->query('My book')

Choose factory method depending on the query type you wish to perform:

If there is no method for the query type you need, you can use rawSearch():

$searchResult = Book::rawSearch()
    ->query(['match' => ['title' => 'The Book']])

It is important to know, that all search request builders share the same generic methods, which provide such basic functionality as sorting, highlighting, etc. Check the full list of available generic methods and the usage examples here.

Finally, refer to this page to get familiar with $searchResult object, pagination and more.