kissge/elastica-friendly-result-set
Composer 安装命令:
composer require kissge/elastica-friendly-result-set
包简介
Wraps Elastica's ResultSet objects.
README 文档
README
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
License
This library is licensed under the MIT License. See LICENSE for the complete license.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-26