# Elasticsearch -> Manticore Search data migration tool

让我们介绍一个可以帮助您将数据从Elasticsearch迁移到Manticore Search的新工具 - https://github.com/manticoresoftware/es2ms 。

此工具可自动将数据从[Elasticsearch](https://www.elastic.co/elasticsearch/)迁移到[Manticore Search](https://manticoresearch.com/)

### [](https://github.com/manticoresoftware/es2ms#requirements)要求
1. Elasticsearch dump工具 : <https://github.com/elasticsearch-dump/elasticsearch-dump>
2. Elasticsearch和Manticore PHP客户端

### [](https://github.com/manticoresoftware/es2ms#install)安装

```bash
composer update
```

### [](https://github.com/manticoresoftware/es2ms#usage)用法

迁移所有索引：


```bash
php migrator.php

```
迁移特定索引：


```bash
php migrator.php  --elasticsearch.host=my.domain.com --elasticsearch.port=9200 --indexes=index1,index2

```


### [](https://github.com/manticoresoftware/es2ms#parameters)参数
- `indexes` - ES索引名称列表，用逗号分隔。默认：迁移所有可用索引
- `dryrun` - 执行干运行而不迁移任何内容。它会打印有关可用ES索引的信息
- `onlyschemas` - 仅创建索引，不迁移数据
- `onlydata` - 迁移数据，假设索引已创建
- `elasticsearch.host` - ES主机，默认：127.0.0.1
- `elasticsearch.port` - ES端口，默认：`92000`
- `elasticsearch.user` - ES用户名，无默认值
- `elasticsearch.pass` - ES密码，无默认值
- `elasticsearch.batch_size` - 每次获取多少ES文档（默认10000）
- `manticoresearch.host` - Manticore主机，默认：127.0.0.1
- `manticoresearch.port` - Manticore HTTP端口，默认：9308
- `manticoresearch.batch_size` - 在Manticore中单个INSERT批次中分组的文档数量（默认10000）
- `limit` - 限制从索引中迁移的文档数量（默认0 - 迁移所有）
- `threads` - 使用多个并行工作线程处理索引（每个工作线程一次处理一个索引），默认为1
- `types.*` - 允许覆盖数据类型的设置（参见[数据类型转换](https://github.com/manticoresoftware/es2ms/blob/master/docs/Data_type_transformation.md)）
- `log`- 日志文件路径；默认是'stdout' - 输出到控制台
- `config` - 从json格式的配置文件中读取参数

从配置文件读取的参数可以通过作为命令行参数提供的值覆盖


```bash
php migrator.php  --config config.sample.json --threads=2

```


### 来源

https://github.com/manticoresoftware/es2ms
