This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Wraps Elastica's ResultSet objects.

1.2.0 2016-07-28 14:47 UTC

This package is not auto-updated.

Last update: 2021-07-24 01:52:24 UTC


Build Status Coverage Status

Thin but powerful wrapper for ruflin/Elastica.


Simply add this library to your project as a dependency:

composer require kissge/elastica-friendly-result-set


Example 1.

use Kissge\ElasticaFriendlyResultSet\Aggregations;

$index = $container->get('fos_elastica.index.<index name>'); // Symfony assumed, but that's not necessary
$aggs = new Aggregations($index->search($query)->getAggregations());

foreach ($aggs-><aggregation name> as $key => $bucket) {
    do_something($bucket-><subaggregation name>);
    do_something($bucket-><subaggregation name>-><term name>);

Example 2.

use Kissge\ElasticaFriendlyResultSet\Aggregations;

$aggs = new Aggregations($index->search($query)->getAggregations());
$this->render($view, ['aggs' => $aggs]);
{% for key, interval in aggs.interval %}
            {{ key }}

            {{ interval.visitors.female }}
            {{ interval.visitors.male }}
            {{ interval.averageScore }}
{% endfor %}


Yuto Kisuge


This library is licensed under the MIT License. See LICENSE for the complete license.