u12206050/elastic-app-scout-driver

Elastic app search driver for Laravel Scout

0.1.0 2020-09-30 13:27 UTC

This package is not auto-updated.

Last update: 2024-09-28 02:15:08 UTC


README

Elastic App Search driver for Laravel Scout.

内容

兼容性

Elastic App Scout Driver 当前版本已测试以下配置

  • PHP 7.2-7.4
  • Elasticsearch 7.0-7.6
  • Laravel 6.x-7.x
  • Laravel Scout 7.x-8.x

需求

  • Laravel Scout
  • Elasticsearch 7.0-7.6
  • App Search 7.0-7.6

安装

可以通过 Composer 安装此库

composer require u12206050/elastic-app-scout-driver

配置

config/scout.php 文件中的 driver 选项更改为 elastic_app

php artisan vendor:publish --provider="ElasticAppScoutDriver\ServiceProvider"

将您的 Elastic App Search URL 和密钥添加到 .env 文件中

ELASTIC_APP_ENDPOINT=
ELASTIC_APP_KEY=

基本用法

此驱动程序使用 Elastic App Search,这意味着您可以使用更多灵活的 where 子句 阅读更多

$orders = App\Order::search('')->where('created_at', [
    'from' => '2020-01-01T12:00:00+00:00',
    'to' => '2020-12-31T12:00:00+00:00'
]);

当省略查询字符串时,将返回所有记录。

$orders = App\Order::search()->where('user_id', 1)->get();

有关更多详细信息和使用示例,请参阅 官方 Laravel Scout 文档app search api

维护

所有 PR 和 RFC 都非常欢迎。