james.xue / laravel-elasticsearch
A Laravel Service Provider for the Elasticsearch API client
Fund package maintenance!
www.paypal.me/xuexiaoxuan
2.3.1
2022-08-04 05:23 UTC
Requires
- php: >=7.0
- elasticsearch/elasticsearch: ^6.0||^7.0
- illuminate/contracts: ~5.0||~6.0||~7.0||~8.0
- symfony/var-dumper: ~4.0||~5.0||~6.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- laravel/framework: ~5.0||~6.0||~7.0||~8.0||~9.0
- orchestra/testbench: ^4.0||^5.0||^6.0||^7.0
- phpunit/phpunit: ^8.0 || ^9.0
README
Install
composer require "james.xue/laravel-elasticsearch"
Publishing configuration
php artisan vendor:publish --tag=elasticsearch
Add env configuration
ELASTICSEARCH_CONNECTION=
ELASTICSEARCH_HOST=127.0.0.1
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_INDEX=
ELASTICSEARCH_TYPE=
Usage
$params = SearchBuilder::setKey(1) ->unsetBody() ->builder(); $params = search()->setKey(1)->unsetBody()->builder(); ElasticsearchClient::get($params); // or $params = SearchBuilder::connection("elastic1") ->setKey(1) ->unsetBody() ->builder(); $params = search("elastic1")->setKey(1)->unsetBody()->builder(); ElasticsearchClient::connection("elastic1")->get($params);
更多使用方法
License
MIT