hedeqiang/elasticsearch

ElasticSearch service provider for Laravel.

v1.0.2 2022-11-22 03:58 UTC

This package is auto-updated.

Last update: 2024-11-22 07:59:17 UTC


README

ElasticSearch service provider for Laravel.

StyleCI build status

安装

$ composer require hedeqiang/elasticsearch -vvv

配置

config/database.php 添加如下代码:

.
.
.
'elasticsearch' => [
    [
        'host'    => env('ES_HOST','localhost'),
        'port'    => env('ES_PORT','9200'),
        'scheme'  => env('ES_SCHEME','http'),
        'user'    => env('ES_USERNAME',null),
        'pass'    => env('ES_PASSWORD','null'),
    ],
],

.env 配置文件

ES_HOST=localhost
ES_PORT=9200
ES_SCHEME=http
ES_USERNAME=
ES_PASSWORD=

使用

服务名使用

return app('es')->info();

Facades 门面使用

use Hedeqiang\ElasticSearch\Facades\Elastic;

return Elastic::es()->info();

TODO

License

MIT