esgo2dump/readme.md

59 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2024-03-22 18:05:47 +08:00
# esgo2dump
# dump elasticsearch with golang
---
- 当前仅支持 elasticsearch 7
---
### install
- with golang >= 1.18
`go install github.com/loveuer/esgo2dump@latest`
- download pre-build release:
2024-03-26 17:16:11 +08:00
[releases](https://github.com/loveuer/esgo2dump/releases)
2024-03-22 18:05:47 +08:00
### usage
`esgo2dump -h`
2024-03-26 17:16:11 +08:00
```bash
esgo2dump --input=http://127.0.0.1:9200/some_index --output=./data.json
2024-03-22 18:05:47 +08:00
2024-03-26 17:16:11 +08:00
esgo2dump --input=http://127.0.0.1:9200/some_index --output=http://192.168.1.1:9200/some_index --limit=5000
2024-03-22 18:05:47 +08:00
2024-05-08 23:14:06 +08:00
esgo2dump --input=http://127.0.0.1:9200/some_index --i-version 6 --output=./data.json
esgo2dump --output=http://127.0.0.1:9200/some_index --o-version 6 --input=./data.json
2024-03-26 17:16:11 +08:00
esgo2dump --input=https://username:password@127.0.0.1:9200/some_index --output=./data.json
2024-03-22 18:05:47 +08:00
2024-05-08 19:15:00 +08:00
esgo2dump --input=http://127.0.0.1:9200/some_index --source='id;name;age;address;phones' --output=./data.json
esgo2dump --input=http://127.0.0.1:9200/some_index --output=./data.json --query='{"match": {"name": "some_name"}}'
esgo2dump --input=http://127.0.0.1:9200/some_index --output=./data.json --query_file=my_queries.json
```
- example_queries.json
```json
{"bool":{"should":[{"term":{"user_id":{"value":"123"}}},{"term":{"user_id":{"value":"456"}}}]}}
{"bool":{"should":[{"term":{"user_id":{"value":"abc"}}},{"term":{"user_id":{"value":"def"}}}]}}
{"bool":{"should":[{"term":{"user_id":{"value":"ABC"}}},{"term":{"user_id":{"value":"DEF"}}}]}}
2024-03-26 17:16:11 +08:00
```
2024-03-22 18:05:47 +08:00
2024-03-26 17:16:11 +08:00
### roadmap
2024-03-22 18:05:47 +08:00
2024-03-26 17:16:11 +08:00
- [x] data dump
- [x] mapping dump
- [x] es to file
- [x] es to es
- [x] auto create index with mapping
- [ ] auto create index with mapping,setting
2024-05-08 23:14:06 +08:00
- [x] support es6
- [ ] support es8