2017 © Pedro Peláez
 

library phalcon-elasticsearch

image

yamichat/phalcon-elasticsearch

  • Wednesday, June 7, 2017
  • by Fedor
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Phalcon + Elastic

How to use

Create your model, (*1)

namespace Models;

use Ovr\Phalcon\Elastic\ModelTrait;

class Project extends Injectable
{
    use ModelTrait;

    protected static $index = 'phalconist';
    protected static $type = 'project';

    /**
     * @param int $limit
     * @return mixed
     */
    public static function myQuery($limit = 25)
    {
        $query = [
            'aggs' => [
                'types' => [
                    'terms' => [
                        'field' => 'composer.type',
                        'size' => $limit,
                    ],
                ]
            ]
        ];

        $resultSet = static::getStorage()->search($query);
        return static::toTags($resultSet->getAggregation('types')['buckets'], 'key', 'doc_count');
    }
}

Use, (*2)

$result = Project::myQuery(25);

License

This project is open-sourced software licensed under the MIT License. See the LICENSE file for more information., (*3)

The Versions

07/06 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Patsura Dmitry

15/11 2014

0.1

0.1.0.0

  Sources   Download

MIT

The Requires

  • php ~5.4

 

by Patsura Dmitry