1. Go to this page and download the library: Download brokerexchange/elasticscout library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brokerexchange / elasticscout example snippets
use ElasticScout\Searchable;
//create search/query object
$search = $article->search()
->boolean()
->should(DSL::match('title',$request->input('query')))
->should(DSL::match('body',$request->input('query')))
->highlight(['body','title'])
->filter(DSL::term('published', 1))
->aggregate(Agg::terms('categories', 'category.name'));
//fire the search
$articles = $search->paginate();
//retrieve aggregation results
$categories = $search->aggregation('categories');
//retrieve highlight results for title field of first result article
$firstArticleTitleHighlights = $articles->first()->highlight('title');