Skip to content

mirocowcom/yii2-elasticsearch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elasticsearch module 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.

Honey modules

Install

$ composer require --prefer-dist mirocow/yii2-elasticsearch

Configure

  • 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 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

Debug

$ 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

Query

For creating queries, you may use https://github.com/crowdskout/es-search-builder

License

FOSSA Status

About

Elasticsearch module used official client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.9%
  • Shell 1.1%