Aquarmini / elasticsearch-demo-phalcon

Elasticsearch 测试项目

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHALCON基础开发框架

本项目以limingxinleo/phalcon-project为基础,进行简易封装。

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Phalcon 官网

wiki

Elasticsearch使用

安装

composer require elasticsearch/elasticsearch

使用

代码目录

# 查看文档目录
php run es:main

注意事项

  • sort关键字,bool.must、bool.filter ... 里需要插入数组 例如:
$params = [
    'index' => ES::ES_INDEX,
    'type' => ES::ES_TYPE_USER,
    'body' => [
        'query' => [
            'bool' => [
                'must' => [
                    ['match' => ['name' => '小王']],
                    ['term' => ['book.author' => 'limx']],
                ],
                'filter' => [
                    ['geo_distance' => [
                        'distance' => '1km',
                        'location' => [
                            'lat' => $lat,
                            'lon' => $lon
                        ],
                    ]],
                ],
            ],

        ],
        'from' => 0,
        'size' => 5,
        'sort' => [
            ['_geo_distance' => [
                'location' => [
                    'lat' => $lat,
                    'lon' => $lon
                ],
                'order' => 'asc',
                'unit' => 'km',
                'mode' => 'min',
            ]],
            [
                'randnum' => 'desc',
            ]
        ],
    ],
];

安装

$ composer create-project limingxinleo/phalcon-basic-project

扩展介绍

limingxinleo/phalcon-project-library

框架所用的基础扩展

limingxinleo/x-swoole-rpc

用户内部服务通信的RPC扩展,基于Swoole Tcp Server & Client 开发。期待Swoole4.0协程时代的到来。

limingxinleo/x-phalcon-config-center

配置中心模块,方便配置文件分类读取

limingxinleo/x-phalcon-enum

基于注解的枚举类

封装版本

测试以及其他DEMO

About

Elasticsearch 测试项目

License:MIT License


Languages

Language:PHP 97.4%Language:Shell 2.4%Language:Volt 0.2%Language:HTML 0.1%