PHPackages                             codeduck/elasticsearch - 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. codeduck/elasticsearch

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

codeduck/elasticsearch
======================

A minimalistic elasticsearch client

v0.5(5y ago)07MITPHPPHP &gt;=7.4.0

Since Mar 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/CodeDuck42/elasticsearch)[ Packagist](https://packagist.org/packages/codeduck/elasticsearch)[ RSS](/packages/codeduck-elasticsearch/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (7)Versions (8)Used By (0)

[![latest stable version](https://camo.githubusercontent.com/ed027d44423441e1cd0fad69547a4b5466219042d54b2f4f46990a050edb556f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656475636b2f656c61737469637365617263682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeduck/elasticsearch)[![license](https://camo.githubusercontent.com/5d0d9ea4613acd45a7fc84c09704d46f8f8118d316c6f98d3e6a2bb1edb33138/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f64656475636b2f656c61737469637365617263683f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeduck/elasticsearch)[![php version](https://camo.githubusercontent.com/abb89837293ce4e10030ecff10735ecc483e35fec8f6cac0ffa29d72b7370b57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f64656475636b2f656c61737469637365617263683f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codeduck/elasticsearch)[![codecov](https://camo.githubusercontent.com/1e018e2dd4923dcc4ebb5f132cf8929407a71971afae04c394e9253bc6081434/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f436f64654475636b34322f656c61737469637365617263683f7374796c653d666c61742d73717561726526746f6b656e3d493841565343514f4e47)](https://codecov.io/gh/CodeDuck42/elasticsearch)[![infection](https://camo.githubusercontent.com/cb63ba0fe2e62dc2fc16b205d8bb58af8814b915e156dd04fcbba93f8c7318be/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d737175617265266c6162656c3d696e66656374696f6e2675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246436f64654475636b3432253246656c61737469637365617263682532466d61696e)](https://infection.github.io)[![unit tests](https://camo.githubusercontent.com/da06ebf733dbbea8b27c57e28f0b1232ac1e996163e8eeae60648320a15e84fe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f436f64654475636b34322f656c61737469637365617263682f556e697425323074657374732f6d61696e3f7374796c653d666c61742d737175617265266c6162656c3d756e69742532307465737473)](https://github.com/CodeDuck42/elasticsearch)[![psalm](https://camo.githubusercontent.com/6e610798a07ef105b5acca88a39b4d6416b8c4f9e9ba41425788b0d3bb21f093/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f436f64654475636b34322f656c61737469637365617263682f537461746963253230616e616c797369732f6d61696e3f7374796c653d666c61742d737175617265266c6162656c3d7073616c6d)](https://github.com/CodeDuck42/elasticsearch)[![elasticsearch](https://camo.githubusercontent.com/91f1ff12ea0d0749825cf5291f40ce035b7c21ef03623634ea5ea6a81a883fe8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f436f64654475636b34322f656c61737469637365617263682f456c61737469637365617263682f6d61696e3f7374796c653d666c61742d737175617265266c6162656c3d656c6173746963736561726368)](https://github.com/CodeDuck42/elasticsearch)

Minimalistic elasticsearch client
=================================

[](#minimalistic-elasticsearch-client)

Born out of frustration about the dependency hell of the available client packages. I didn't need a library with all the features, as a result this package was born. It provides the bare minimum to index, delete and query documents.

This library is compatible with elasticsearch 6.x and 7.x and has no dependencies on the official elasticsearch client packages.

All issues should go to the [issue tracker from github](https://github.com/CodeDuck42/elasticsearch/issues).

Features
--------

[](#features)

- Adding a document to an elasticsearch index
- Delete a document from an elasticsearch index
- Send multiple adding and delete actions as a bulk action
- Run a query on an elasticsearch index

Usage
-----

[](#usage)

```
use CodeDuck\Elasticsearch\Client;
use CodeDuck\Elasticsearch\SimpleClient;
use Symfony\Component\HttpClient\HttpClient;

$client = new SimpleClient(
    new Client(HttpClient::create(), 'http://127.0.0.1:9200'),
    'my-index', '_doc'
);

$client->begin();
$client->add('ID-123', ['name' => 'foo', 'foo' => 12345]);
$client->add('ID-234', ['name' => 'bar', 'foo' => 12345]);
$client->commit();

$result = $client->query(['query' => ['term' => ['name' => 'bar']]]);

foreach ($result->getDocuments() as $document) {
    echo json_encode($document->getSource(), JSON_THROW_ON_ERROR) . PHP_EOL;
}

$client->begin();
$client->delete('ID-123');
$client->delete('ID-234');
$client->commit();
```

More detailed examples can be found here: [full client](docs/example-full-client.md), [simple client](docs/example-simple-client.md).

TODO
----

[](#todo)

- Complete documentation
- Actions should return the response from elasticsearch, especially for bulk actions
- Investigating options for authentication besides username and password in the server url (necessary?)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Total

7

Last Release

1876d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9dc73924b46c9efa33748f82e245d863ae67a1a6cc28ba1aeee01ad4e17f966?d=identicon)[CodeDuck42](/maintainers/CodeDuck42)

---

Top Contributors

[![CodeDuck42](https://avatars.githubusercontent.com/u/15831200?v=4)](https://github.com/CodeDuck42 "CodeDuck42 (22 commits)")

---

Tags

clientelasticsearchSimpleminikiss

###  Code Quality

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/codeduck-elasticsearch/health.svg)

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

###  Alternatives

[elasticsearch/elasticsearch

PHP Client for Elasticsearch

5.3k178.3M943](/packages/elasticsearch-elasticsearch)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[jsq/amazon-es-php

Support for using IAM authentication with the official Elasticsearch PHP client

9310.6M13](/packages/jsq-amazon-es-php)[nervetattoo/elasticsearch

ElasticSearch client for PHP 5.3

342190.1k1](/packages/nervetattoo-elasticsearch)[babenkoivan/elastic-client

The official PHP Elasticsearch client integrated with Laravel

544.0M6](/packages/babenkoivan-elastic-client)

PHPackages © 2026

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