定制 directorytree/opensearch-scout-driver 二次开发

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

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

directorytree/opensearch-scout-driver

Composer 安装命令:

composer require directorytree/opensearch-scout-driver

包简介

OpenSearch driver for Laravel Scout

README 文档

README

An OpenSearch driver for Laravel Scout.

Installation

Install the package with Composer:

composer require directorytree/opensearch-scout-driver

Publish the Scout configuration file if your application has not already done so:

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

Set Scout to use OpenSearch:

'driver' => env('SCOUT_DRIVER', 'opensearch'),

Publish the OpenSearch client configuration:

php artisan vendor:publish --provider="DirectoryTree\OpenSearchClient\OpenSearchClientServiceProvider"

Publish the OpenSearch Scout configuration:

php artisan vendor:publish --provider="DirectoryTree\OpenSearchScoutDriver\OpenSearchScoutServiceProvider"

Configuration

Configure the OpenSearch client connection in config/opensearch-client.php:

'default' => env('OPENSEARCH_CONNECTION', 'default'),

'connections' => [
    'default' => [
        'hosts' => [
            env('OPENSEARCH_HOST', 'localhost:9200'),
        ],
    ],
],

The Scout driver configuration is published to config/opensearch-scout.php:

'refresh_documents' => env('OPENSEARCH_SCOUT_REFRESH_DOCUMENTS', false),

Usage

Use Scout as usual:

use App\Models\Post;

$posts = Post::search('laravel')->get();

The driver converts Scout builders into OpenSearch search requests and uses the configured OpenSearch client connection to index, delete, flush, and search models.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-23