ppokatilo/elastica-entity-mapping-bundle
最新稳定版本:v0.5.0
Composer 安装命令:
composer require ppokatilo/elastica-entity-mapping-bundle
包简介
Automatically updates elasticsearch mappings
关键字:
README 文档
README
An Symfony2 bundle that automatically updates your Elasticsearch mappings or notifies you of changes.
How it works
An elastica client service is modified to be constructed using a factory. The factory reads Composer's
autoload files to know about all your dependencies. It will then scan each directory for a subdirectory
called Entity and search the PHP files in that subdirectory for the @ElasticsearchMapping annotation.
When instantiating the elastica client service, the factory will first check if the mapping of registered entities on disk differs from that in Elasticsearch. If so, it will either throw an exception or try to update the mapping automatically.
Example usage
-
app/AppKernel.php
class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { $bundles[] = new SHyx0rmZ\ElasticaEntityMapping\ElasticaEntityMappingBundle(); } return $bundles; } } // ...
-
app/config/config_dev.yml
elastica_entity_mapping: clients: - service: elastica.client update: false # throw exceptions instead of updating mapping automatically indices: - name: %elastica_index_name% alias: dev settings: vendor/example/entitybundle/settings.json - name: my_other_index alias: other
-
vendor/example/entitybundle/ExampleEntity.php
/** * @ElasticsearchMapping(file="./example_entity.json", indices="dev,other") **/ class ExampleEntity { // ... }
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-21