pmishev / elasticsearch-dsl-php
Elasticsearch DSL library
v9.0.0
2026-06-16 16:27 UTC
Requires
- php: ^8.3
- symfony/serializer: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.74
- php-coveralls/php-coveralls: ^2.7.0
- phpunit/phpunit: ^10.0
- rector/rector: ^2.0
This package is auto-updated.
Last update: 2026-06-16 18:00:45 UTC
README
Elasticsearch DSL library to provide objective query builder for the elasticsearch-php client. You can easily build any Elasticsearch query and transform it to an array.
This is a fork of the abandoned https://github.com/ongr-io/ElasticsearchDSL
Requirements
- PHP
^8.3 symfony/serializer^6.4 || ^7.0 || ^8.0(Symfony 6.4 LTS, 7.x and 8.x)
Version matrix
| Elasticsearch version | Bundle version |
|---|---|
| >= 9.0 | >= 9.0 |
| >= 8.0, < 9.0 | >= 8.0 |
| >= 7.0, < 8.0 | >= 7.0 |
| >= 6.0, < 7.0 | >= 6.0 |
| >= 5.0, < 6.0 | >= 5.0 |
Documentation
The online documentation of the bundle is here
Try it!
Installation
$ composer require pmishev/elasticsearch-dsl-php ^9.0
Example usage
<?php require 'vendor/autoload.php'; // Composer autoload use Elasticsearch\ClientBuilder; use ONGR\ElasticsearchDSL\Query\MatchAllQuery; use ONGR\ElasticsearchDSL\Search; // Build an elasticsearch-php client $clientBuilder = ClientBuilder::create(); $clientBuilder->setHosts(['localhost:9200']); $client = $clientBuilder->build(); $search = (new Search())->addQuery(new MatchAllQuery()); $params = [ 'index' => 'your_index', 'body' => $search->toArray(), ]; $results = $client->search($params);