gbprod / elasticsearch-extra-bundle
此包已弃用且不再维护。未建议替代包。
m6web/elasticsearch-bundle 的额外工具
v0.1.0
2016-03-25 21:02 UTC
Requires
- php: >=5.5
- m6web/elasticsearch-bundle: ^1.0
- symfony/console: ^2.3|^3.0
- symfony/framework-bundle: ^2.3|^3.0
- symfony/yaml: ^2.3|^3.0
Requires (Dev)
- atoum/atoum: ^2.6
This package is auto-updated.
Last update: 2020-06-07 07:56:57 UTC
README
我将不再维护此包,推荐使用 elastica-extra-bundle。
管理索引和类型的额外工具。基于 m6web/elasticsearch-bundle 构建。
安装
使用 composer
composer require gbprod/elasticsearch-extra-bundle
更新你的 app/AppKernel.php
文件
public function registerBundles() { $bundles = array( new M6Web\Bundle\ElasticsearchBundle\M6WebElasticsearchBundle(), new GBProd\ElasticsearchExtraBundle\ElasticsearchExtraBundle(), ); }
查看 M6WebElasticsearchBundle 配置客户端。
索引管理操作
配置
设置索引配置
elasticsearch_extra: indices: my_index: settings: number_of_shards: 3 number_of_replicas: 2 mappings: my_type: _source: enabled: true properties: first_name: type: string analyzer: standard age: type: integer my_index_2: ~
查看 官方文档 了解选项。
创建索引
使用默认客户端
php app/console elasticsearch:index:create my_index
或使用指定客户端
php app/console elasticsearch:index:create my_index --client=my_client
删除索引
使用默认客户端
php app/console elasticsearch:index:delete my_index --force
或使用指定客户端
php app/console elasticsearch:index:delete my_index --force --client=my_client
设置索引设置
使用默认客户端
php app/console elasticsearch:index:put_settings my_index
或使用指定客户端
php app/console elasticsearch:index:put_settings my_index --client=my_client
设置索引映射
使用默认客户端
php app/console elasticsearch:index:put_mappings my_index my_type
或使用指定客户端
php app/console elasticsearch:index:put_mappings my_index my_type --client=my_client