PHP code example of enrise / zf-elasticsearch

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

    

enrise / zf-elasticsearch example snippets


$searchClient = $serviceLocator->get('elasticsearch');
$searchClient->search();

// config/application.config.php
return array(
    'modules' => array(
        // ...
        'Enrise\\ZfModule\\ElasticSearch',
    )
);

// In your config file
return [
    'elasticsearch' => [
        'hosts' => [
            'es1.enrise.com',
            'es2.enrise.com'
        ],
        'logging' => true
    ]
];