An easy way to use the official Elastic Search 5.x-6.x client in your Laravel 5.
An easy way to use the official Elastic Search 5.x~6.x client in your Laravel 5.
Warning: This Manual is for addons/elasticsearch:3.0.0, Elasticsearch 6.x. If you use the Elasticsearch 5.x, Please visit 2.0.1
Elasticsearch 6.0 removes(deprecats) the TYPE. (like database's table)
So We use the ES's index named env('SCOUT_PREFIX').$mode->getTable()
for each table
eg:
.env
SCOUT_PREFIX = my_application_name-
Index name like:
my_application_name-users
my_application_name-roles
This Builder will search in ES, not Database.
User::search('must')->where('name', 'admin')->whereIn('type', ['1', '2'])->get();
// page 1
User::search()->where(...)->paginate(25);
// page 4
User::search()->where(...)->paginate(25, ['*'], 'page', 4)
User::search('must', function($elasticsearch, &$query){
print_r($query); // Show the DSL JSON
// ... edit the $query.
})->where(...)->get();
elasticsearch was written by Colin Viebrock, Fly and is released under the MIT License.
Copyright (c) 2016-2018