PHP code example of open20 / amos-elasticsearch

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

    

open20 / amos-elasticsearch example snippets



'modules' => [
    'elasticsearch' => [
        'class' => '\open20\elasticsearch\Module',
        'modelMap' => [
            'ElasticModelSearch' => 'common\modules\transformermanagers\ElasticModelSearch',
        ],
        'hosts' => ['http://localhost:9201', ],
        'modelsEnabled' => [
          	/**
             * Add here the classnames of the models where you want the elasticsearch => class trasformation of model
             * (i.e. 'open20\amos\news\models\News' => 'common\modules\transformermanagers\NewsTransformerManager' )
             */
        ],
    ],
],

php vendor/bin/luya elastic/re-index-cms // rebuild cms pages elasticsearch index

php vendor/bin/luya elastic/rebuild // rebuild all Record models elasticsearch index

php vendor/bin/luya elastic/clear-all-indexes // clear all elasticsearch index