Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

c-daney/ElasticaFriendlyResultSet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

ElasticaFriendlyResultSet

Build Status Coverage Status

Thin but powerful wrapper for ruflin/Elastica.

Installation

Simply add this library to your project as a dependency:

composer require kissge/elastica-friendly-result-set

Usage

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 %}
 <tr>
 <th>
 {{ key }}
 </th>
 <td>
 {{ interval.visitors.female }}
 </td>
 <td>
 {{ interval.visitors.male }}
 </td>
 <td>
 {{ interval.averageScore }}
 </td>
 </tr>
{% endfor %}

Author

Yuto Kisuge

License

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

About

Wraps Elastica's ResultSet objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%

AltStyle によって変換されたページ (->オリジナル) /