nails/module-elasticsearch

This is the "Elasticsearch" module for Nails.

dev-develop 2021-10-11 18:00 UTC

README

license tests Scrutinizer Code Quality

This is the Elasticsearch Module for Nails, it provides a Nails friendly interface for working with the Elasticsearch PHP client.

Installing Elasticsearch

You should follow the latest instructions for installation on Elastic's official documentation page.

Configuring your Application

Configure which hosts the client connects to by defining a service property called hosts. By default this will connect to localhost:9200.

If you wish to override this in your application, create a services.php file at application/services/nails/module-elasticsearch/.

Example services.php below:

/**
 * Include the base services file so that the client can be instantiated,
 * remember you are simply overriding defaults.
 */
$aServices = include 'vendor/nails/module-elasticsearch/services/services.php';

/**
 * Define an array of hosts for the Elasticsearch client to use.
 */
$aServices['properties']['hosts'] = array(
    'http://example.com:1234',
    'http://example.co.uk:9200'
);

/**
 * Remember to return the services array so that the Nails Factory picks it up
 */
return $aServices;