-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philipp Heckel
committed
Apr 8, 2021
1 parent
639683d
commit 11ef470
Showing
6 changed files
with
89 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,50 @@ | ||
# elastictl | ||
|
||
Simple tool to dump an elasticsearch index into a file to later insert it wih high concurrency. | ||
This can be used for load testing. In my local cluster, I was able to index ~10k documents per second. | ||
Simple tool import/export Elasticsearch indices into a file, and/or reshard an index. The tool can be used for: | ||
|
||
Usage: | ||
* Backup/restore of an Elasticsearch index | ||
* Performance test an Elasticsearch cluster (import with high concurrency, see `--workers`) | ||
* Change the shard/replica count of an index (see `reshard` subcomment) | ||
|
||
In my local cluster, I was able to import ~10k documents per second. | ||
|
||
## Build | ||
``` | ||
# Build | ||
go build | ||
$ go build | ||
``` | ||
|
||
Or via goreleaser: | ||
``` | ||
$ make [build | build-snapshot] | ||
``` | ||
|
||
## Usage: | ||
|
||
# Dump index | ||
### Export/dump an index to a file | ||
The first line of the output format is the mapping, the rest are the documents. | ||
``` | ||
# Entire index | ||
elastictl export dummy > dummy.json | ||
# Insert index with high concurrency | ||
# Only a subset of documents | ||
elastictl export \ | ||
--search '{"query":{"bool":{"must_not":{"match":{"eventType":"Success"}}}}}' \ | ||
dummy > dummy.json | ||
``` | ||
|
||
### Import to new index | ||
``` | ||
# With high concurrency | ||
cat dummy.json | elastictl import --workers 100 dummy-copy | ||
``` | ||
|
||
# Reshard (import/export) an index | ||
### Reshard (import/export) an index | ||
This commands export the index `dummy` to `dummy.json` and re-imports it as `dummy` using a different number of shards. | ||
This command does `DELETE` the index after exporting it! | ||
``` | ||
elastictl reshard \ | ||
--search '{"query":{"bool":{"must_not":{"match":{"eventType":"Success"}}}}}' \ | ||
--shards 1 \ | ||
--replicas 1 \ | ||
dummy-index | ||
dummy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters