flc/laravel-elasticsearch

Laravel Elasticsearch 构建类

v1.0.1 2019-04-05 16:45 UTC

This package is auto-updated.

Last update: 2021-11-05 22:51:08 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();

TODO

  • 聚合查询
  • 写入、更新、删除文档
  • 原生支持
  • 辅助方法

LICENSE

  • MIT
  • Anti 996