2017 © Pedro Peláez
 

library phalcon-elasticsearch

image

ovr/phalcon-elasticsearch

  • Wednesday, February 25, 2015
  • by ovr
  • Repository
  • 7 Watchers
  • 28 Stars
  • 1,265 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 1 Open issues
  • 2 Versions
  • 4 % 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

25/02 2015

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