定制 caxy/elasticsearch-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

caxy/elasticsearch-bundle

最新稳定版本:0.0.1

Composer 安装命令:

composer require caxy/elasticsearch-bundle

包简介

Symfony Elasticsearch Bundle

关键字:

README 文档

README

Create Elasticsearch client using 'config.yml'

Installation

composer.json

# composer.json

"require": {
	"caxy/elasticsearch-bundle": "0.0.*"
	...
}

and run composer update command.

AppKernel.php

# app/AppKernel.php

public function registerBundles()
{
    bundles = array(
        // ...
        new Caxy\Bundle\ElasticsearchBundle\CaxyElasticsearchBundle(),
    );
    
    retrun bundles();
}

Configuration

config.yml

# app/config/config.php

caxy_elasticsearch:
    client:
        default:
            hosts: [ "localhost" ] # Require
        named:
            class: Your\Elasticsearch\Client
            hosts: [ "localhost", "127.0.0.1","localhost:9200", "127.0.0.1:9201" ]
            log_path: elasticsearch.log # Optional
            log_level: Logger::WARNING # Optional

Defaults

@see Elasticsearch PHP API -full list of configrations-

Usage

Get client from service.

Using default settings Elasticsearch client.

# Bundle/Controller/Controller.php

public function fooAction()
{
    $es = $this->container->get('caxy_elasticsearch_client');
    // or
    $es = $this->container->get('caxy_elasticsearch_client.default');
}

Using named settings.

# Bundle/Controller/Controller.php

public function fooAction()
{
    $es = $this->container->get('caxy_elasticsearch_client.named');
    get_class($es); // Your\Elasticsearch\Client
}

Client

@see elasticsearch/elasticsearch web site or Documentation

统计信息

  • 总下载量: 43
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 23
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-26