diimu / elasticsearch
A Laravel 4 Service Provider for the Elasticsearch API client
Requires
- php: >=5.3.0
- elasticsearch/elasticsearch: ~0.4
- illuminate/support: ~4
This package is not auto-updated.
Last update: 2024-11-19 05:08:34 UTC
README
This is a Laravel 4 Service Provider for the offical Elasticsearch API client: http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/index.html
Usage
Require
"shift31/laravel-elasticsearch": "dev-master"
in your composer.jsonCreate app/config/elasticsearch.php, modifying the following contents accordingly:
return array( 'hosts' => array( 'your.elasticsearch.server:9200' ), 'logPath' => 'path/to/your/elasticsearch/log' 'logLevel' => Logger::INFO; );
Add
'Shift31\LaravelElasticsearch\LaravelElasticsearchServiceProvider'
to your'providers'
array in app/config/app.phpUse the
Es
facade to access any method from theElasticsearch\Client
class, for example:$searchParams['index'] = 'your_index'; $searchParams['size'] = 50; $searchParams['body']['query']['query_string']['query'] = 'foofield:barstring'; $result = Es::search($searchParams);
Default Configuration
If you return an empty array in the config file:
'hosts'
defaults to localhost:9200
'logPath'
defaults to storage_path() . '/logs/hostbase-elasticsearch-' . php_sapi_name() . '.log'
'logLevel'
defaults to Logger::INFO