PHP code example of mirocow / yii2-elasticsearch

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

    

mirocow / yii2-elasticsearch example snippets


return [
    'modules' => [

        // elasticsearch
        common\modules\elasticsearch\Module::MODULE_NAME => [
          'class' => common\modules\elasticsearch\Module::class,
          'indexes' => [
            common\repositories\indexes\ProductsSearchIndex::class
          ]
        ],

    ],
    'bootstrap' => [
        mirocow\elasticsearch\Bootstrap::class,
    ]
];


        /** @var QueryBuilder $query */
        $query = new QueryBuilder;
        $query = $query
            ->add(QueryHelper::bool($filter, $must, $should, $must_not))
            ->aggregations($aggregations)
            ->withSource('attributes');
bash
$ php yii elasticsearch/index/rebuild