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. sexlog/elasticsearch-query-builder

ActiveLibrary

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

2.1.0(10mo ago)1115.2k↓27.3%2MITPHP

Since Jan 18Pushed 9mo 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 1mo ago

READMEChangelog (10)Dependencies (3)Versions (34)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

48

—

FairBetter than 95% of packages

Maintenance55

Moderate activity, may be stable

Popularity33

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity74

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 ~192 days

Recently: every ~365 days

Total

19

Last Release

319d 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 (4 commits)")[![lucasnaguiar](https://avatars.githubusercontent.com/u/12227275?v=4)](https://github.com/lucasnaguiar "lucasnaguiar (2 commits)")[![gui-cmarques](https://avatars.githubusercontent.com/u/99689688?v=4)](https://github.com/gui-cmarques "gui-cmarques (1 commits)")[![helissoncamargo](https://avatars.githubusercontent.com/u/31102021?v=4)](https://github.com/helissoncamargo "helissoncamargo (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

[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

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

PHP ETL - Extract Transform Load - Data processing framework

81733.7k](/packages/flow-php-flow)[drevops/git-artifact

Package artifact from your codebase in CI and push it to a separate git repo.

2133.2k](/packages/drevops-git-artifact)

PHPackages © 2026

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