Extension for Elastic Scout Driver

v1.15.0 2021-01-05 11:22 UTC



68747470733a2f2f706f7365722e707567782e6f72672f626162656e6b6f6976616e2f656c61737469632d73636f75742d6472697665722d706c75732f762f737461626c65 68747470733a2f2f706f7365722e707567782e6f72672f626162656e6b6f6976616e2f656c61737469632d73636f75742d6472697665722d706c75732f646f776e6c6f616473 68747470733a2f2f706f7365722e707567782e6f72672f626162656e6b6f6976616e2f656c61737469632d73636f75742d6472697665722d706c75732f6c6963656e7365 badge.svg badge.svg badge.svg 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d626c7565

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 CustomSearch, 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 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.