Elasticsearch client based on official Elasticsearch PHP library
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
documents Add files via upload Nov 4, 2018
src Update SearchDataProvider.php Nov 16, 2018
LICENSE.md Create LICENSE.md Apr 16, 2018
README.md Update README.md Nov 5, 2018
README.ru.md Update README.ru.md Nov 5, 2018
composer.json Update composer.json Nov 4, 2018


Elasticsearch client based on official Elasticsearch PHP library


Latest Stable Version Latest Unstable Version Total Downloads License Join the chat at https://gitter.im/Mirocow/yii2-elasticsearch FOSSA Status Maintainability

Docs are available in english and russian. Based on https://github.com/elastic/elasticsearch

Honey modules


Elasticsearch 5.6.x

$ 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


  • 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' => [

    'bootstrap' => [

Create index

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= idekey=xdebug" && php7.0 ./yii elasticsearch/index/create products_search


        /** @var QueryBuilder $query */
        $query = new QueryBuilder;
        $query = $query
            ->add(QueryHelper::bool($filter, $must, $should, $must_not))


FOSSA Status

I use JetBrains products to develop yii2-elasticsearch !