PHPackages                             brokerexchange/elasticbuilder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. brokerexchange/elasticbuilder

ActiveLibrary[Database &amp; ORM](/categories/database)

brokerexchange/elasticbuilder
=============================

Query Builder for Elasticsearch.

v7.1.3(11mo ago)111.1k3MITPHP

Since Jun 15Pushed 11mo ago3 watchersCompare

[ Source](https://github.com/BrokerExchange/ElasticBuilder)[ Packagist](https://packagist.org/packages/brokerexchange/elasticbuilder)[ Docs](http://brokerexchange.github.io/ElasticBuilder/)[ RSS](/packages/brokerexchange-elasticbuilder/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)DependenciesVersions (37)Used By (0)

ElasticBuilder
==============

[](#elasticbuilder)

[![Latest Stable Version](https://camo.githubusercontent.com/a0c7b0032b8e4834e2eff643b4e3468a5f9d3b0f6762b96be5ee1b0c5f2c8f4a/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b657265786368616e67652f656c61737469636275696c6465722f762f737461626c65)](https://packagist.org/packages/brokerexchange/elasticbuilder)[![Latest Unstable Version](https://camo.githubusercontent.com/a21e248c7adefe5de6e0aba314e39d0afd3798f23f19da10f221095157a97a8f/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b657265786368616e67652f656c61737469636275696c6465722f762f756e737461626c65)](https://packagist.org/packages/brokerexchange/elasticbuilder)[![Total Downloads](https://camo.githubusercontent.com/c0d868ee4af34994e6c7fc584d44f5eb304d86b7e2bd201f82d77e4258cf839c/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b657265786368616e67652f656c61737469636275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/brokerexchange/elasticbuilder)[![License](https://camo.githubusercontent.com/88719e26219915ecf5739c2bd2f4a299d511b4f222a89663c787d64de0d41189/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b657265786368616e67652f656c61737469636275696c6465722f6c6963656e7365)](https://packagist.org/packages/brokerexchange/elasticbuilder)[![composer.lock](https://camo.githubusercontent.com/abc02c9adb9683d670ade05202cdbcc87be239ec4cf2bc0eed38b6b50a97bacd/68747470733a2f2f706f7365722e707567782e6f72672f62726f6b657265786368616e67652f656c61737469636275696c6465722f636f6d706f7365726c6f636b)](https://packagist.org/packages/brokerexchange/elasticbuilder)

*Query DSL Builder for Elasticsearch queries*

Use ElasticBuilder to combine multiple queries/filters/aggregations into Elasticsearch Query DSL within Laravel projects!

License
-------

[](#license)

ElasticBuilder is released under the MIT Open Source License,

Copyright
---------

[](#copyright)

ElasticBuilder © Broker Exchange Network 2018

Overview
--------

[](#overview)

ElasticBuilder is a Laravel 5.x Framework Package consisting of Static Methods and Abstract classes you can use to build Elasticsearch query DSL AND map your query input arguments to the DSL as it is generated. Also handles paging arguments, sorting, and aggregations. Provides Laravel Framework Service Provider and Facade, as well as a Trait you can apply to your eloquent models.

Installation
------------

[](#installation)

ElasticBuilder must use Elasticsearch 1.x or greater, and Laravel 5.x

- Add `"brokerexchange/elasticbuilder": "^1.0.0"` to your `composer.json` file
- Run `composer update`
- Add provider `ElasticBuilder\ElasticBuilderServiceProvider::class` to your list of providers in `app/config/app.php` of your laravel project
- Add facade `'Eb' => ElasticBuilder\Eb::class` to your list of aliases in `app/config/app.php` of your laravel project

Examples
--------

[](#examples)

### Facade

[](#facade)

Example of using a Facade

Here is how you add a clause to a query (in this case must clause to bool query).

```
