Skip to content

ss-wiking/elastic-orm

Repository files navigation

Elasticsearch ORM like Eloquent

Latest Version on Packagist Total Downloads GitHub Actions

High level Elasticsearch ORM for Laravel with query builder and models

Installation

You can install the package via composer:

composer require ss-wiking/elastic-orm

Usage

Model

use SsWiking\ElasticOrm\Model;

class Product extends Model {
    /**
     * Model index name
     * If not provided, it will be got from model name in plural form
     *
     * @var string
     */
    protected string $index = 'products';
}

Query Builder via Model

$products = Product::whereIn('id', $ids)
    ->whereGreaterThan('price', $minPrice)
    ->get();

Query Builder via Facade

use SsWiking\ElasticOrm\Facades\ElasticOrm;

ElasticOrm::index('goods')->limit(10)->offset(10)->get();

Publishing config

php artisan vendor:publish --provider="SsWiking\ElasticOrm\Providers\ElasticOrmServiceProvider" --tag=config

Generate model's meta

php artisan elastic-orm:meta "App\Models\Elastic\YourModelName"

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Elasticsearch ORM like Eloquent

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages