PHPackages                             sexlog/elasticsearch-query-builder - 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. [Search &amp; Filtering](/categories/search)
4. /
5. sexlog/elasticsearch-query-builder

ActiveLibrary[Search &amp; Filtering](/categories/search)

sexlog/elasticsearch-query-builder
==================================

2.2.0(1mo ago)1016.4k↓37.7%4MITPHPCI failing

Since Jan 18Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/sexlog/elasticsearch-query-builder)[ Packagist](https://packagist.org/packages/sexlog/elasticsearch-query-builder)[ RSS](/packages/sexlog-elasticsearch-query-builder/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (6)Versions (35)Used By (0)

sexlog/elasticsearch-query-builder
==================================

[](#sexlogelasticsearch-query-builder)

This is a library to query data from ElasticSearch. I have just started the development of this library and there is a lot to be done.

My aim is to communicate with ElasticSearch in a fully object oriented way.

Examples
--------

[](#examples)

### Basic query

[](#basic-query)

```
    $hosts = ['10.0.0.10:9200'];
    $index = 'products';

    $client = \Elasticsearch\ClientBuilder::fromConfig(['hosts' => $hosts]);
    $elasticSearch = new ElasticSearch\ElasticSearch($index, $client);

    // SELECT * FROM products WHERE product_name = 'ElasticSearch' LIMIT 4
    $query = new ElasticSearch\Query();
    $query->where('product_name', 'ElasticSearch');

    $elasticSearch->setQuery($query)
                  ->take(4)
                  ->get();

    // Paging results
    $results = $elasticSearch->page(1)
                             ->get();

    $results = $elasticSearch->page(2)
                             ->get();

```

### Query with a Filter

[](#query-with-a-filter)

```
    /*
     * SELECT id, product_name, price, updated_at
     * FROM products
     * WHERE product_name LIKE 'car%' AND category = 3 LIMIT 20 OFFSET 0
     */
    $query = new ElasticSearch\Query();
    $query->wildcard('product_name', 'car*');

    $filter = new ElasticSearch\Filter();
    $filter->where('category', 3);

    // You should always use the take method before paging
    $elasticSearch->select('id, product_name, price, updated_at')
                  ->setQuery($query)
                  ->setFilter($filter)
                  ->take(20)
                  ->page(0)
                  ->get();

    // Paging
    $results = $elasticSearch->page(1)
                             ->get();

```

### Logging

[](#logging)

```
    $hosts = ['10.0.0.10:9200'];
    $index = 'products';

    $client = \Elasticsearch\ClientBuilder::fromConfig(['hosts' => $hosts]);
    $elasticSearch = new ElasticSearch\ElasticSearch($index, $client);

    $errorHandler = new \Monolog\Handler\StreamHandler('elastic.log', \Monolog\Logger::ERROR);

    $logger = new \Monolog\Logger('elastic');
    $logger->pushHandler($errorHandler);

    $elasticSearch->setLogger($logger);

```

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance90

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~198 days

Recently: every ~180 days

Total

20

Last Release

51d ago

Major Versions

1.4.0 → 2.0.02024-08-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/2880e729fc1d4a2c6ec1f4a294f8e53bbc8796796d043a1d9a0ec490b7ed2bff?d=identicon)[rmartignoni](/maintainers/rmartignoni)

![](https://www.gravatar.com/avatar/160cf202f9b8ff510eacd5c7b1f2a0a270ba175afe13cf989bee5951b541170d?d=identicon)[murilo-pereira](/maintainers/murilo-pereira)

---

Top Contributors

[![rmartignoni](https://avatars.githubusercontent.com/u/24656787?v=4)](https://github.com/rmartignoni "rmartignoni (11 commits)")[![murilo-pereira](https://avatars.githubusercontent.com/u/30474692?v=4)](https://github.com/murilo-pereira "murilo-pereira (6 commits)")[![guilhermefalves](https://avatars.githubusercontent.com/u/42912349?v=4)](https://github.com/guilhermefalves "guilhermefalves (5 commits)")[![lucasnaguiar](https://avatars.githubusercontent.com/u/12227275?v=4)](https://github.com/lucasnaguiar "lucasnaguiar (2 commits)")[![helissoncamargo](https://avatars.githubusercontent.com/u/31102021?v=4)](https://github.com/helissoncamargo "helissoncamargo (1 commits)")[![gui-cmarques](https://avatars.githubusercontent.com/u/99689688?v=4)](https://github.com/gui-cmarques "gui-cmarques (1 commits)")[![gamsanches06](https://avatars.githubusercontent.com/u/60519121?v=4)](https://github.com/gamsanches06 "gamsanches06 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sexlog-elasticsearch-query-builder/health.svg)

```
[![Health](https://phpackages.com/badges/sexlog-elasticsearch-query-builder/health.svg)](https://phpackages.com/packages/sexlog-elasticsearch-query-builder)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[magento/community-edition

Magento 2 (Open Source)

12.2k53.6k13](/packages/magento-community-edition)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
