PHP code example of baka / elasticsearch

1. Go to this page and download the library: Download baka/elasticsearch 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/ */

    

baka / elasticsearch example snippets



#config.php

'namespace' => [
    'controller' => 'Project\Controllers',
    'models' => 'Project\Models',
],

'elasticSearch' => [
    'hosts' => [getenv('ELASTIC_HOST')], //change to pass array
],



#service.php

$di->set('queue', function () use ($config) {
    //Connect to the queue
    $queue = new Phalcon\Queue\Beanstalk\Extended([
        'host' => $config->beanstalk->host,
        'prefix' => $config->beanstalk->prefix,
    ]);

    return $queue;
});






class Users extends \Baka\Elasticsearch\Model
{

}




/**
 * Search controller
 */
class SearchController extends BaseController
{
    use \Baka\Elasticsearch\SearchTrait
}