Docs are available in english and russian.
$ composer require --prefer-dist mirocow/yii2-elasticsearch
- Create a class that implements the
common\modules\elasticsearch\contracts\Index
interface. - Add it to the module configuration in
common/config/main.php
- Start indexing
return [
'modules' => [
// elasticsearch
common\modules\elasticsearch\Module::MODULE_NAME => [
'class' => common\modules\elasticsearch\Module::class,
'indexes' => [
common\repositories\indexes\ProductsSearchIndex::class
]
],
],
'bootstrap' => [
common\modules\elasticsearch\Bootstrap::class
]
];
Create empty index
$ php yii elasticsearch/index/create index_name
Fill index with all documents
$ php yii elasticsearch/index/populate index_name
Destroy an index and all its data
$ php yii elasticsearch/index/destroy index_name
Remove all existing indexes, re-create all indexes and re-index all documents for all indexes
$ php yii elasticsearch/index/rebuild
$ export PHP_IDE_CONFIG="serverName=www.site.loc" && export XDEBUG_CONFIG="remote_host=192.168.1.6 idekey=xdebug" && php7.0 ./yii elasticsearch/index/create products_search
For creating queries, you may use https://github.com/crowdskout/es-search-builder