定制 wehaa/laravel-scout-elasticsearch 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wehaa/laravel-scout-elasticsearch

Composer 安装命令:

composer require wehaa/laravel-scout-elasticsearch

包简介

Elasticsearch Driver for Laravel Scout

README 文档

README

This package makes use of the Elasticsearch driver for Laravel Scout.

Supporting Laravel and 5.7+

Installation

You can install the package via composer:

composer require wehaa/laravel-scout-elasticsearch

Setting up Elasticsearch configuration

This command will publish the scout.php configuration file to your config directory:

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

Then add the elasticsearch key in the array on config/scout.php file.

     'elasticsearch' => [
        /*
        |--------------------------------------------------------------------------
        | Custom Elasticsearch Client Configuration
        |--------------------------------------------------------------------------
        |
        | This array will be passed to the Elasticsearch client.
        | See configuration options here:
        |
        | http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
        */
        
        'hosts' => [
            [
                'host' => env('ELASTICSEARCH_HOST', 'localhost'),
                'port' => env('ELASTICSEARCH_PORT', '9200'),
                'scheme' => '', // http or https
                'user' => '',
                'pass' => ''
            ]
        ],
        
        /**
         * The client will retry n times
         */
        'retries' => env('ELASTICSEARCH_RETRIES', 3),
        
        /*
        |--------------------------------------------------------------------------
        | Default Index Name
        |--------------------------------------------------------------------------
        |
        | This is the index name use for all models
        */
        
        'default_index' => 'wehaa',
     ]

.env file example:

SCOUT_DRIVER=elasticsearch
ELASTICSEARCH_HOST=http://127.0.0.1
ELASTICSEARCH_PORT=9200

Usage:

Now you can use Laravel Scout as described in the official documentation

Batch Import

If you are installing Scout into an existing project, you may already have database records you need to import into your search driver. Scout provides an import Artisan command that you may use to import all of your existing records into your search indexes:

php artisan scout:import "App\Post"

The flush command may be used to remove all of a model's records from your search indexes:

php artisan scout:flush "App\Post"

统计信息

  • 总下载量: 1.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固