> 文章作者:亚马逊云科技加油站/罗技123
1. 导出的结构看起来使用 API 查的:
```
{"_index":".kibana_1","_id":"config:2.11.0","_score":1,"_source":{"config":
{"buildNum":929202301},"type":"config","references":[],"migrationVersion":
{"config":"7.9.0"},"updated_at":"2024-01-13T04:59:17.184Z"}}
{"_index":"abc","_id":"1","_score":1,"_source":{"a":1}}
```
2. 跨集群迁移,源端没认证的集群,输入命令写了用户名密码花式报错,会把本地路径给拼到 URL 里
```
Error: ENOENT: no such file or directory, open
'C:\\Users\\ec3\\Desktop\\333\\'https:\\admin:ZAQ!2wsx@vpc-
ekslog-ezkqfpyofgio5wgfiiscivs3c4.cn-north-1.es.amazonaws.com.cn\\*'' Emitted 'error' event on
ReadStream instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at
emitErrorCloseNT (node:internal/streams/destroy:116:3) at
process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno:
-4058, code: 'ENOENT', syscall: 'open', path:
"C:\\\\Users\\\\ec3\\\\Desktop\\\\333\\\\'https://username:password@host2/*'"
```
3. 源端和目标端不能都是通配符
迁移 mapping 会报错权限不够,即使 admin 已经注册为主用户
```
elasticdump --input='https://host1/*' --output='https://username:password@host2/*' --
type=mapping Sat, 13 Jan 2024 08:32:13 GMT | starting dump Sat, 13 Jan 2024 08:32:13 GMT
| got 1 objects from source elasticsearch (offset: 0) Sat, 13 Jan 2024 08:32:13 GMT |
Error Emitted => {"root_cause":[{"type":"security_exception","reason":"no permissions
for [] and User [name=admin, backend_roles=[],
requestedTenant=null]"}],"type":"security_exception","reason":"no permissions for [] and
User [name=admin, backend_roles=[], requestedTenant=null]"} Sat, 13 Jan 2024 08:32:13
GMT | Error Emitted => {"root_cause":[{"type":"security_exception","reason":"no
permissions for [] and User [name=admin, backend_roles=[],
requestedTenant=null]"}],"type":"security_exception","reason":"no permissions for [] and
User [name=admin, backend_roles=[], requestedTenant=null]"} Sat, 13 Jan 2024 08:32:13
GMT | Total Writes: 0 Sat, 13 Jan 2024 08:32:13 GMT | dump ended with error (get phase)
=> [object Object]
```
迁移 data 报错说索引不能用特殊字符:
```
elasticdump --input='https://host1/*' --output='https://username:password@host2/*' --
type=data 报错 type: 'invalid_index_name_exception', reason: 'Invalid index name [*],
must not contain the following characters [ , ", *, \\\\, <, |, ,, >, /, ?]',
```
4. 目标端只能写一个索引,但是源端可以配置多个(不会报错, 简直就是把源索引都写到一个目标里
这逻辑完全像是用 API 拿100条:
- Sat, 13 Jan 2024 09:33:10 GMT | got 100 objects from source elasticsearch (offset: 118400)
- Sat, 13 Jan 2024 09:33:10 GMT | sent 100 objects to destination elasticsearch, wrote 100
- Sat, 13 Jan 2024 09:33:10 GMT | got 100 objects from source elasticsearch (offset: 118500)
```
elasticdump --input='https://host1/*' --output='https://username:password@host2/abcd'
--type=data
```
[![3.png](https://dev-media.amazoncloud.cn/34636f2f2272482ea08912bcaef3d173_3.png "3.png")](https://summit.amazoncloud.cn/2024/register.html?source=DSJAVfG2GS7gEk2Osm6kYXAa+8HnSEVdbCVjkuit7lE= )