承接 ppokatilo/elastica-entity-mapping-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ppokatilo/elastica-entity-mapping-bundle

最新稳定版本:v0.5.0

Composer 安装命令:

composer require ppokatilo/elastica-entity-mapping-bundle

包简介

Automatically updates elasticsearch mappings

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

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
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

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