hungneox / ramen-elastic-query by hungneox

Lumen/Laravel package for interacting with elasticsearch
4
7
2
Package Data
Maintainer Username: hungneox
Maintainer Contact: hungnq1989@gmail.com (Hung Neo)
Package Create Date: 2018-01-10
Package Last Update: 2018-01-21
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:10:25
Package Statistics
Total Downloads: 4
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 7
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Ramen Elastic Query (In development)

Build Status

Fluent Pseudo-SQL query builder for Elasticsearch built on top of Lumen Elasticsearch

Installation

Run the following command to install the package through Composer:

composer require hungneox/ramen-elastic-query

Add the following line to bootstrap/app.php:

$app->register(Neox\Ramen\Elastic\ElasticQueryServiceProvider::class);

Usage

Simple select

Object initiation or Facade both work

$builder = app(Builder::class);

$result = $builder
	->use('content') // collection
	->from('article') // type
	->find('TIYKtQX', '_id', ['id', 'title', 'description']);
            
$result = ES::use('content')
		->from('article')
		->find('TIYKtQX', '_id', ['id', 'title', 'description']);

Normal where clause

$result = $builder->select('id', 'description')
			->from('recipe')
			->where('_id', '=', $id)
			->get();

Fulltext match

$result = $builder
            ->use('content')
            ->select('id', 'title', 'description', 'featured')
            ->from('article')
            ->where('title', 'like', 'Auringonkukan')
            ->orderBy('featured', 'desc')
            ->get();

Deletion

ES::use('content')->from('article')->delete($id);

License

See LICENSE.