dev-master
9999999-devYii2 elasticsearch client
GPL-v3
The Requires
- php >=5.4.0
- yiisoft/yii2 >=2.0.0
- elasticsearch/elasticsearch ^5.0
Yii2 elasticsearch client
, (*1)
Docs are available in english and russian. Based on https://github.com/elastic/elasticsearch, (*3)
$ composer require --prefer-dist mirocow/yii2-elasticsearch
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - $ sudo apt-get install apt-transport-https $ echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list $ sudo apt-get update && sudo apt-get install elasticsearch $ composer require --prefer-dist mirocow/yii2-elasticsearch
common\modules\elasticsearch\contracts\Index
interface.common/config/main.php
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, ] ];
Create empty index, (*4)
$ php yii elasticsearch/index/create index_name
Fill index with all documents, (*5)
$ php yii elasticsearch/index/populate index_name
Destroy an index and all its data, (*6)
$ php yii elasticsearch/index/destroy index_name
Remove all existing indexes, re-create all indexes and re-index all documents for all indexes, (*7)
$ 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
<?php /** @var QueryBuilder $query */ $query = new QueryBuilder; $query = $query ->add(QueryHelper::bool($filter, $must, $should, $must_not)) ->aggregations($aggregations) ->withSource('attributes');
Yii2 elasticsearch client
GPL-v3