PHPackages                             ulff/elasticsearch-php-client-bundle - 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. ulff/elasticsearch-php-client-bundle

ActiveSymfony-bundle[Search &amp; Filtering](/categories/search)

ulff/elasticsearch-php-client-bundle
====================================

A very simple bundle for integrating Symfony2.x/3.x with Elasticsearch-PHP 5.0

2.3.0(8y ago)312.3k1MITPHPPHP &gt;=5.5

Since Jul 12Pushed 8y ago3 watchersCompare

[ Source](https://github.com/ulff/ElasticsearchPhpClientBundle)[ Packagist](https://packagist.org/packages/ulff/elasticsearch-php-client-bundle)[ RSS](/packages/ulff-elasticsearch-php-client-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (14)Used By (0)

ElasticsearchPhpClientBundle
============================

[](#elasticsearchphpclientbundle)

Setting up bundle
-----------------

[](#setting-up-bundle)

#### Version Matrix

[](#version-matrix)

You need to match your version of Elasticsearch to the appropriate version of this library.

Bundle VersionElasticsearch Version2.05.01.0&gt;= 1.0, ⇐ 5.0### Step 1: Install bundle

[](#step-1-install-bundle)

Install bundle using [composer](https://getcomposer.org):

```
php composer.phar require "ulff/elasticsearch-php-client-bundle:2.0"

```

Enable the bundle in AppKernel.php:

```
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Ulff\ElasticsearchPhpClientBundle\UlffElasticsearchPhpClientBundle(),
    ];

    // ...
}
```

### Step 2: add bundle configuration

[](#step-2-add-bundle-configuration)

Add following configuration to config.yml:

```
# app/config/config.yml

ulff_elasticsearch_php_client:
    elastic_host: "localhost"
    elastic_port: "9200"
```

Replace values with proper ones.

Usage
-----

[](#usage)

### Client usage

[](#client-usage)

Elasticsearch client is available as a service:

```
$client = $this->get('ulff_elasticsearch_php_client.client');
```

#### Create new index:

[](#create-new-index)

```
$indexParams = new IndexParams('index-name', 'type-name', 'id');
$indexParams->setBody(['someField' => 'some value']);
$response = $client->index($indexParams);
```

Returns [IndexResponse](Model/IndexResponse.php) object.

#### Get document:

[](#get-document)

```
$getParams = new GetParams('index-name', 'type-name', 'id');
$response = $client->get($getParams);
```

Returns [GetResponse](Model/GetResponse.php) object.

#### Delete document:

[](#delete-document)

```
$deleteParams = new DeleteParams('index-name', 'type-name', 'id');
$response = $client->delete($deleteParams);
```

Returns [DeleteResponse](Model/DeleteResponse.php) object.

#### Delete by query:

[](#delete-by-query)

```
$deleteParams = new DeleteByQueryParams('index-name', 'type-name');
$deleteParams->setBody([
   'query' => [
       'match_all' => new \stdClass(),
   ]
]);
$response = $client->deleteByQuery($deleteParams);
```

Returns [DeleteByQueryResponse](Model/DeleteByQueryResponse.php) object.

#### Make search query:

[](#make-search-query)

```
$searchParams = new SearchParams('index-name', 'type-name');
$searchParams->setBody([
    'query' => [
        'match' => [
            'someField' => 'some value'
        ]
    ]
]);
$response = $client->search($searchParams);
```

#### Update document:

[](#update-document)

```
$updateParams = new UpdateParams('index-name', 'type-name', 'id');
$updateParams->setBody(['someField' => 'some value']);
$response = $client->update($updateParams);
```

Returns [UpdateResponse](Model/UpdateResponse.php) object.

### Purger usage

[](#purger-usage)

Bundle offers a possibility to purge whole index (by deleting and recreating empty). This can be useful e.g. for testing purposes.

There is a separate `ulff_elasticsearch_php_client.purger` service provided with the bundle. Following example shows how to purge index:

```
$purger = $this->get('ulff_elasticsearch_php_client.purger');
$purger->purgeIndex('index_name');
```

Full documentation:
-------------------

[](#full-documentation)

This bundle is a client for:

- [Elasticsearch-PHP 5.0](https://www.elastic.co/guide/en/elasticsearch/client/php-api/5.0/index.html)
- [Elasticsearch-PHP 2.0](https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/index.html)

Follow the documentation there.

License
-------

[](#license)

This bundle is licensed under the MIT license. Please, see the complete license in the bundle `LICENSE` file.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 75.4% 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 ~55 days

Recently: every ~64 days

Total

12

Last Release

2985d ago

Major Versions

1.0.0 → 2.0.02016-10-28

1.1.1 → 2.2.02017-05-26

### Community

Maintainers

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

---

Top Contributors

[![ulff](https://avatars.githubusercontent.com/u/2435762?v=4)](https://github.com/ulff "ulff (43 commits)")[![tetsuobe](https://avatars.githubusercontent.com/u/2757697?v=4)](https://github.com/tetsuobe "tetsuobe (11 commits)")[![duxet](https://avatars.githubusercontent.com/u/821707?v=4)](https://github.com/duxet "duxet (3 commits)")

---

Tags

bundleelasticsearchSymfony2elasticphp5PHP7symfony3elasticsearch-php

### Embed Badge

![Health badge](/badges/ulff-elasticsearch-php-client-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ulff-elasticsearch-php-client-bundle/health.svg)](https://phpackages.com/packages/ulff-elasticsearch-php-client-bundle)
```

###  Alternatives

[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[babenkoivan/elastic-client

The official PHP Elasticsearch client integrated with Laravel

544.0M6](/packages/babenkoivan-elastic-client)[madewithlove/elasticsearcher

Wrapper on top of the ElasticSearch PHP SDK which allows easier index/document/query management.

264133.2k2](/packages/madewithlove-elasticsearcher)[thomasjsn/laravel-scout-elastic

Elastic Driver for Laravel Scout

1411.5k](/packages/thomasjsn-laravel-scout-elastic)[blomstra/search

Replaces Flarum search with one powered by an elastic search server.

114.9k](/packages/blomstra-search)

PHPackages © 2026

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