-
Notifications
You must be signed in to change notification settings - Fork 125
1. Installation
Basem Khirat edited this page Oct 23, 2017
·
2 revisions
$ composer require basemkhirat/elasticsearchBasemkhirat\Elasticsearch\ElasticsearchServiceProvider::class'ES' => Basemkhirat\Elasticsearch\Facades\ES::class$ php artisan vendor:publish --provider="Basemkhirat\Elasticsearch\ElasticsearchServiceProvider"$ composer require basemkhirat/elasticsearch$app->register(Basemkhirat\Elasticsearch\ElasticsearchServiceProvider::class);3) Copy package config directory vendor/basemkhirat/elasticsearch/src/config to root folder alongside with app directory.
$app->withFacades();If you don't want to enable working with Lumen facades you can access the query builder using app("es").
app("es")->index("my_index")->type("my_type")->get();
# is similar to
ES::index("my_index")->type("my_type")->get();You can install package with any composer-based applications
$ composer require basemkhirat/elasticsearchrequire "vendor/autoload.php";
use Basemkhirat\Elasticsearch\Connection;
$connection = Connection::create([
'servers' => [
[
"host" => '127.0.0.1',
"port" => 9200,
'user' => '',
'pass' => '',
'scheme' => 'http',
]
],
'index' => 'my_index',
]);
# access the query builder using created connection
$documents = $connection->search("hello")->get();