devouted/elastic-index-manager
最新稳定版本:v2.0.2
Composer 安装命令:
composer require devouted/elastic-index-manager
包简介
About
README 文档
README
A Symfony console tool for managing Elasticsearch indexes interactively.
Requirements
- PHP 8.2+
- Symfony 7.3+
- Elasticsearch PHP client 8.x
Installation
composer require devouted/elastic-index-manager
Configuration
Register the command in your services.yaml:
Devouted\ElasticIndexManager\Command\ElasticIndexManagerCommand: tags: ['console.command']
The command automatically discovers any service returning an Elastic\Elasticsearch\Client or Elastic\Elasticsearch\ClientBuilder instance. Example service definition:
elasticsearch.client.default: public: true class: Elastic\Elasticsearch\ClientBuilder factory: [ 'Elastic\Elasticsearch\ClientBuilder', 'create' ] calls: - [ setHosts, [ [ '%env(ELASTICSEARCH_TRANSPORT)%://%env(ELASTICSEARCH_HOST)%:%env(ELASTICSEARCH_PORT)%' ] ] ]
Usage
bin/console elasticsearch:index:manage
Connection selection
Choose which Elasticsearch connection to use from discovered services.
Index management
Once connected, you get an interactive table of all indexes with a summary footer showing totals for document counts and storage sizes.
Available actions
| Action | Description |
|---|---|
| Change Elastic Client | Switch to a different ES connection |
| Filter for empty indexes | Show only indexes with docs.count = 0 |
| Filter by index pattern | Filter indexes by name pattern |
| Reset filter | Remove active filter |
| Sort | Sort by any column (asc/desc), supports size unit conversion |
| Show Index Mapping | View field mappings and fetch sample data for a selected index |
| Delete an index | Delete a single index (with confirmation) |
| Delete all indexes by filter | Bulk delete all currently filtered indexes (with confirmation) |
Testing
vendor/bin/simple-phpunit
Unit tests cover:
ListSorter— byte conversion, index sorting by various columnsFilterByNameOfIndexes— pattern matching filterFilterNotEmptyIndexes— empty index filter
Integration tests require a running Symfony kernel with Elasticsearch connection.
License
MIT
统计信息
- 总下载量: 960
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-25