PHPackages                             purewater2011/hyperf-elasticsearch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. purewater2011/hyperf-elasticsearch

ActiveLibrary[API Development](/categories/api)

purewater2011/hyperf-elasticsearch
==================================

The Elasticsearch Driver for Hyperf Scout

01PHP

Since Jul 7Pushed 10mo agoCompare

[ Source](https://github.com/purewater2011/hyperf-elasticsearch)[ Packagist](https://packagist.org/packages/purewater2011/hyperf-elasticsearch)[ RSS](/packages/purewater2011-hyperf-elasticsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Hyperf Elasticsearch Driver
===========================

[](#hyperf-elasticsearch-driver)

根据 [babenkoivan/scout-elasticsearch-driver](https://github.com/babenkoivan/scout-elasticsearch-driver) 改造的基于Hyperf框架的ElasticSearch组件。

!!! 支持hyperf2.2版本 !!!
---------------------

[](#-支持hyperf22版本-)

[![GitHub issues](https://camo.githubusercontent.com/11c0581a07887e68a56090b4d3c0df6137734f554236f01ee09673eadbde731d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f707572657761746572323031312f6879706572662d656c61737469637365617263683f7374796c653d706c6173746963)](https://github.com/purewater2011/hyperf-elasticsearch/issues)[![GitHub forks](https://camo.githubusercontent.com/88b509758f28893f798f78aac1c79963fe227592148f0d3c396f554b4255b1e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f707572657761746572323031312f6879706572662d656c61737469637365617263683f7374796c653d706c6173746963)](https://github.com/purewater2011/hyperf-elasticsearch/network)[![GitHub stars](https://camo.githubusercontent.com/0fc2654b831a65d3ede7258b95d9812b9b9473709499e4ceff1b608e5b46b364/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f707572657761746572323031312f6879706572662d656c61737469637365617263683f7374796c653d706c6173746963)](https://github.com/purewater2011/hyperf-elasticsearch/stargazers)

Requirements
------------

[](#requirements)

- PHP version &gt;=7.2.0
- Hyperf Framework version &gt;2.0
- Elasticsearch version &gt;=7

Installation
------------

[](#installation)

```
composer require purewater2011/hyperf-elasticsearch
```

Configuration
-------------

[](#configuration)

> 发布配置文件

```
php bin/hyperf.php vendor:publish purewater2011/hyperf-elasticsearch
```

- 配置文件在config/autoload/scout\_elastic.php， 配置参数如下： \*

OptionDescriptiondriver默认defalutsoft\_delete是否软删除prefix前缀client.hostElasticSearch client, default `localhost:9200`.如果存在密码: `user:password@host:port`max\_connections最大连接数，默认500indexer索引方式,目前支持`single`和`bulk`chunk.searchable批量处理的搜索块数量chuck.unsearchable批量处理的搜索块数量update\_mapping是否自动更新，默认 `true`document\_refreshThis option controls when updated documents appear in the search results. Can be set to 'true', 'false', 'wait\_for' or null. More details about this option you can find [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html). By default set to null.Index Configurator
------------------

[](#index-configurator)

所以配置器类用于设置ElasticSearch的索引，可使用以下方式创建新的索引配置器：

```
php bin/hyperf.php make:index-configurator MyIndexConfigurator
```

默认目录为`App\ElasticIndexConfigurator\MyIndexConfigurator`

```
