flc/laravel-elasticsearch

Laravel Elasticsearch 构建类

v2.0.0 2024-02-07 10:36 UTC

This package is auto-updated.

Last update: 2024-10-07 12:00:31 UTC


README

Latest Stable Version Total Downloads License 996.icu LICENSE

安装

composer require flc/laravel-elasticsearch

版本矩阵

配置

使用文档

示例

<?php

use Elasticsearch;

Elasticsearch::index('users')
    ->select('id', 'username', 'password', 'created_at', 'updated_at', 'status', 'deleted')
    ->whereTerm('status', 1)
    ->orWhereIn('deleted', [1, 2])
    ->whereNotExists('area')
    ->where(['status' => 1, 'closed' => 0])
    ->where(function ($query) {
        $query->where('status', '=', 1)
            ->where('closed', 1)
            ->where('username', 'like', '张三');
            ->where('username', 'match', '李四');
    })
    ->orderBy('id', 'desc')
    ->take(2)
    ->paginate(10);
    // ->get();
    // ->search();

LICENSE

  • MIT
  • Anti 996