m6web/elasticsearch-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

m6web/elasticsearch-bundle

最新稳定版本:v4.1.0

Composer 安装命令:

composer require m6web/elasticsearch-bundle

包简介

Symfony2 Bundle on top of elasticsearch/elasticsearch-php

README 文档

README

Integration of the Elasticsearch official PHP client within a Symfony Project.

Features

This bundle creates one or more Elasticsearch client services from settings defined in the application configuration.

Usage

Installation

You must first add the bundle to your composer.json:

 "require": { "m6web/elasticsearch-bundle": "dev-master" }

Then register the bundle in your AppKernel class:

<?php public function registerBundles() { $bundles = array( // ... new M6Web\Bundle\ElasticsearchBundle\M6WebElasticsearchBundle(), ); // ... }

Configuration

In your config.yml, you can configure one or more Elasticsearch clients:

m6web_elasticsearch: default_client: my_client clients: my_client: hosts: - 'localhost:9200' - 'http://other_host:9201' my_other_client: hosts: - 'other_server:9200'

From this configuration, the bundle will create two services :

  • m6web_elasticsearch.client.my_client that will connect to two Elasticsearch instances: localhost on port 9200 and other_host on port 9201
  • m6web_elasticsearch.client.my_other_client that will connect to one Elasticsearch instances: other_server on port 9200

It will also create m6web_elasticsearch.client.default which is an alias for m6web_elasticsearch.client.my_client

Additional configuration

Each client can have additional configuration parameters that will be used to instantiate the \Elasticsearch\Client. Ex:

m6web_elasticsearch: clients: my_client: hosts: - 'https://username:password@localhost:9200' headers: 'Accept-Encoding': ['gzip'] retries: 2 logger: monolog.logger.custom connectionPoolClass: '\Elasticsearch\ConnectionPool\StaticConnectionPool' selectorClass: '\Elasticsearch\ConnectionPool\Selectors\RandomSelector' connectionParams: client: timeout: 3 connect_timeout: 1

Events

The bundle dispatches \M6Web\Bundle\ElasticsearchBundle\EventDispatcher\ElasticsearchEvent events containing various information about the Elasticsearch requests.

Events are fired with the name m6web.elasticsearch.

Tests

You can launch the unit tests using:

./vendor/bin/atoum 

License

ElasticsearchBundle is licensed under the MIT license.

统计信息

  • 总下载量: 626.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 49
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固