Backup Elasticsearch index using elasticsearch-dump.
Installation
Install javascript package manager.
$ sudo apt install npm
Install elasticdump
package.
$ sudo npm install -g elasticdump
Display usage information.
$ elasticdump --help
elasticdump: Import and export tools for elasticsearch version: 6.99.0 Usage: elasticdump --input SOURCE --output DESTINATION [OPTIONS] --input Source location (required) --input-index Source index and type (default: all, example: index/type) --output Destination location (required) --output-index Destination index and type (default: all, example: index/type) --overwrite Overwrite output file if it exists (default: false) --limit How many objects to move in batch per operation limit is approximate for file streams (default: 100) --size How many objects to retrieve (default: -1 -> no limit) --debug Display the elasticsearch commands being used (default: false) --quiet Suppress all messages except for errors (default: false) --type What are we exporting? (default: data, options: [settings, analyzer, data, mapping, policy, alias, template, component_template, index_template]) --filterSystemTemplates Whether to remove metrics-*-* and logs-*-* system templates (default: true]) --templateRegex Regex used to filter templates before passing to the output transport (default: (metrics|logs|\\..+)(-.+)?) --delete Delete documents one-by-one from the input as they are moved. Will not delete the source index (default: false) --delete-with-routing Passes the routing query-param to the delete function used to route operations to a specific shard. (default: false) --skip-existing Skips resource_already_exists_exception when enabled and exit with success (default: false) --headers Add custom headers to Elastisearch requests (helpful when your Elasticsearch instance sits behind a proxy) (default: '{"User-Agent": "elasticdump"}') Type/direction based headers are supported .i.e. input-headers/output-headers (these will only be added based on the current flow type input/output) --esCompress if true, add an Accept-Encoding header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. Note: Automatic decoding of the response content is performed on the body data returned through request (both through the request stream and passed to the callback function) but is not performed on the response stream (available from the response event) which is the unmodified http.IncomingMessage object which may contain compressed data. --params Add custom parameters to Elastisearch requests uri. Helpful when you for example want to use elasticsearch preference --input-params is a specific params extension that can be used when fetching data with the scroll api --output-params is a specific params extension that can be used when indexing data with the bulk index api NB : These were added to avoid param pollution problems which occur when an input param is used in an output source (default: null) --searchBody Preform a partial extract based on search results (when ES is the input, default values are if ES > 5 `'{"query": { "match_all": {} }, "stored_fields": ["*"], "_source": true }'` else `'{"query": { "match_all": {} }, "fields": ["*"], "_source": true }'` [As of 6.68.0] If the searchBody is preceded by a @ symbol, elasticdump will perform a file lookup in the location specified. NB: File must contain valid JSON --searchWithTemplate Enable to use Search Template when using --searchBody If using Search Template then searchBody has to consist of "id" field and "params" objects If "size" field is defined within Search Template, it will be overridden by --size parameter See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html for further information (default: false) --searchBodyTemplate A method/function which can be called to the searchBody doc.searchBody = { query: { match_all: {} }, stored_fields: [], _source: true }; May be used multiple times. Additionally, searchBodyTemplate may be performed by a module. See [searchBody Template](#search-template) below. --sourceOnly Output only the json contained within the document _source Normal: {"_index":"","_type":"","_id":"", "_source":{SOURCE}} sourceOnly: {SOURCE} (default: false) --ignore-errors Will continue the read/write loop on write error (default: false) --ignore-es-write-errors Will continue the read/write loop on a write error from elasticsearch (default: true) --scrollId The last scroll Id returned from elasticsearch. This will allow dumps to be resumed used the last scroll Id & `scrollTime` has not expired. --scrollTime Time the nodes will hold the requested search in order. (default: 10m) --scroll-with-post Use a HTTP POST method to perform scrolling instead of the default GET (default: false) --maxSockets How many simultaneous HTTP requests can we process make? (default: 5 [node <= v0.10.x] / Infinity [node >= v0.11.x] ) --timeout Integer containing the number of milliseconds to wait for a request to respond before aborting the request. Passed directly to the request library. Mostly used when you don't care too much if you lose some data when importing but rather have speed. --offset Integer containing the number of rows you wish to skip ahead from the input transport. When importing a large index, things can go wrong, be it connectivity, crashes, someone forgets to `screen`, etc. This allows you to start the dump again from the last known line written (as logged by the `offset` in the output). Please be advised that since no sorting is specified when the dump is initially created, there's no real way to guarantee that the skipped rows have already been written/parsed. This is more of an option for when you want to get most data as possible in the index without concern for losing some rows in the process, similar to the `timeout` option. (default: 0) --noRefresh Disable input index refresh. Positive: 1. Much increase index speed 2. Much less hardware requirements Negative: 1. Recently added data may not be indexed Recommended using with big data indexing, where speed and system health in a higher priority than recently added data. --inputTransport Provide a custom js file to use as the input transport --outputTransport Provide a custom js file to use as the output transport --toLog When using a custom outputTransport, should log lines be appended to the output stream? (default: true, except for `$`) --awsChain Use [standard](https://aws.amazon.com/blogs/security/a-new-and-standardized-way-to-manage-credentials-in-the-aws-sdks/) location and ordering for resolving credentials including environment variables, config files, EC2 and ECS metadata locations _Recommended option for use with AWS_ --awsAccessKeyId --awsSecretAccessKey When using Amazon Elasticsearch Service protected by AWS Identity and Access Management (IAM), provide your Access Key ID and Secret Access Key --awsIniFileProfile Alternative to --awsAccessKeyId and --awsSecretAccessKey, loads credentials from a specified profile in aws ini file. For greater flexibility, consider using --awsChain and setting AWS_PROFILE and AWS_CONFIG_FILE environment variables to override defaults if needed --awsService Sets the AWS service that the signature will be generated for (default: calculated from hostname or host) --awsRegion Sets the AWS region that the signature will be generated for (default: calculated from hostname or host) --awsUrlRegex Regular expression that defined valied AWS urls that should be signed (default: ^https?:\\.*.amazonaws.com.*$) --transform A javascript, which will be called to modify documents before writing it to destination. global variable 'doc' is available. Example script for computing a new field 'f2' as doubled value of field 'f1': doc._source["f2"] = doc._source.f1 * 2; --httpAuthFile When using http auth provide credentials in ini file in form `user=password= ` --support-big-int Support big integer numbers --retryAttempts Integer indicating the number of times a request should be automatically re-attempted before failing when a connection fails with one of the following errors `ECONNRESET`, `ENOTFOUND`, `ESOCKETTIMEDOUT`, ETIMEDOUT`, `ECONNREFUSED`, `EHOSTUNREACH`, `EPIPE`, `EAI_AGAIN` (default: 0) --retryDelay Integer indicating the back-off/break period between retry attempts (milliseconds) (default : 5000) --parseExtraFields Comma-separated list of meta-fields to be parsed --maxRows supports file splitting. Files are split by the number of rows specified --fileSize supports file splitting. This value must be a string supported by the **bytes** module. The following abbreviations must be used to signify size in terms of units b for bytes kb for kilobytes mb for megabytes gb for gigabytes tb for terabytes e.g. 10mb / 1gb / 1tb Partitioning helps to alleviate overflow/out of memory exceptions by efficiently segmenting files into smaller chunks that then be merged if needs be. --fsCompress gzip data before sending output to file. On import the command is used to inflate a gzipped file --s3AccessKeyId AWS access key ID --s3SecretAccessKey AWS secret access key --s3Region AWS region --s3Endpoint AWS endpoint can be used for AWS compatible backends such as OpenStack Swift and OpenStack Ceph --s3SSLEnabled Use SSL to connect to AWS [default true] --s3ForcePathStyle Force path style URLs for S3 objects [default false] --s3Compress gzip data before sending to s3 --s3ServerSideEncryption Enables encrypted uploads --s3SSEKMSKeyId KMS Id to be used with aws:kms uploads --s3ACL S3 ACL: private | public-read | public-read-write | authenticated-read | aws-exec-read | bucket-owner-read | bucket-owner-full-control [default private] --s3StorageClass Set the Storage Class used for s3 (default: STANDARD) --s3Options Set all s3 parameters shown here https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#createMultipartUpload-property A escaped JSON string or file can be supplied. File location must be prefixed with the @ symbol (default: null) --s3Configs Set all s3 constructor configurations A escaped JSON string or file can be supplied. File location must be prefixed with the @ symbol (default: null) --retryDelayBase The base number of milliseconds to use in the exponential backoff for operation retries. (s3) --customBackoff Activate custom customBackoff function. (s3) --tlsAuth Enable TLS X509 client authentication --cert, --input-cert, --output-cert Client certificate file. Use --cert if source and destination are identical. Otherwise, use the one prefixed with --input or --output as needed. --key, --input-key, --output-key Private key file. Use --key if source and destination are identical. Otherwise, use the one prefixed with --input or --output as needed. --pass, --input-pass, --output-pass Pass phrase for the private key. Use --pass if source and destination are identical. Otherwise, use the one prefixed with --input or --output as needed. --ca, --input-ca, --output-ca CA certificate. Use --ca if source and destination are identical. Otherwise, use the one prefixed with --input or --output as needed. --inputSocksProxy, --outputSocksProxy Socks5 host address --inputSocksPort, --outputSocksPort Socks5 host port --handleVersion Tells elastisearch transport to handle the `_version` field if present in the dataset (default : false) --versionType Elasticsearch versioning types. Should be `internal`, `external`, `external_gte`, `force`. NB : Type validation is handle by the bulk endpoint and not elasticsearch-dump --csvConfigs Set all fast-csv configurations A escaped JSON string or file can be supplied. File location must be prefixed with the @ symbol (default: null) --csvDelimiter The delimiter that will separate columns. (default : ',') --csvFirstRowAsHeaders If set to true the first row will be treated as the headers. (default : true) --csvRenameHeaders If you want the first line of the file to be removed and replaced by the one provided in the `csvCustomHeaders` option (default : true) --csvCustomHeaders A comma-seperated listed of values that will be used as headers for your data. This param must be used in conjunction with `csvRenameHeaders` (default : null) --csvWriteHeaders Determines if headers should be written to the csv file. (default : true) --csvIgnoreEmpty Set to true to ignore empty rows. (default : false) --csvIgnoreAutoColumns Set to true to prevent the following columns @id, @index, @type from being written to the output file (default : false) --csvSkipLines If number is > 0 the specified number of lines will be skipped. (default : 0) --csvSkipRows If number is > 0 then the specified number of parsed rows will be skipped (default : 0) --csvTrim Set to true to trim all white space from columns. (default : false) --csvRTrim Set to true to right trim all columns. (default : false) --csvLTrim Set to true to left trim all columns. (default : false) --csvHandleNestedData Set to true to handle nested JSON/CSV data. NB : This is a very opinionated implementation! (default : false) --csvIdColumn Name of the column to extract the record identifier (id) from When exporting to CSV this column can be used to override the default id (@id) column name (default : null) --csvIndexColumn Name of the column to extract the record index from When exporting to CSV this column can be used to override the default index (@index) column name (default : null) --csvTypeColumn Name of the column to extract the record type from When exporting to CSV this column can be used to override the default type (@type) column name (default : null) --force-os-version Forces the OpenSearch version used by elasticsearch-dump. (default: 7.10.2) --help This page Examples: # Copy an index from production to staging with mappings: elasticdump \ --input=http://production.es.com:9200/my_index \ --output=http://staging.es.com:9200/my_index \ --type=mapping elasticdump \ --input=http://production.es.com:9200/my_index \ --output=http://staging.es.com:9200/my_index \ --type=data # Backup index data to a file: elasticdump \ --input=http://production.es.com:9200/my_index \ --output=/data/my_index_mapping.json \ --type=mapping elasticdump \ --input=http://production.es.com:9200/my_index \ --output=/data/my_index.json \ --type=data # Backup and index to a gzip using stdout: elasticdump \ --input=http://production.es.com:9200/my_index \ --output=$ \ | gzip > /data/my_index.json.gz # Backup the results of a query to a file elasticdump \ --input=http://production.es.com:9200/my_index \ --output=query.json \ --searchBody "{\"query\":{\"term\":{\"username\": \"admin\"}}}" ------------------------------------------------------------------------------ Learn more @ https://github.com/taskrabbit/elasticsearch-dump
Backup single index
Inspect current indices.
$ curl "172.19.0.3:9200/_cat/indices?v=true"
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open history_index ZyRG3E6MSmK_LKIOBQxSPw 1 0 9996 0 355.3kb 355.3kb green open bookmarks_index vNUg4mgET7-XjyY6w90LbQ 1 0 1024 0 74.4kb 74.4kb
Backup index settings.
$ elasticdump --input http://172.19.0.3:9200/history_index --output history.settings --type settings
Sun, 02 Apr 2023 22:11:30 GMT | starting dump Sun, 02 Apr 2023 22:11:30 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:11:30 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:11:30 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:11:30 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:11:30 GMT | dump complete
Inspect stored settings.
$ cat history.settings
"{\"history_index\":{\"settings\":{\"index\":{\"number_of_shards\":\"1\",\"number_of_replicas\":\"0\"}}}}"
Backup index alias.
$ elasticdump --input http://172.19.0.3:9200/history_index --output history.alias --type alias
Sun, 02 Apr 2023 22:02:26 GMT | starting dump Sun, 02 Apr 2023 22:02:26 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:02:26 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:02:26 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:02:26 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:02:26 GMT | dump complete
Ispect stored data.
$ cat history.alias
"{\"history_index\":{\"aliases\":{\"history\":{}}}}"
Backup index mapping.
$ elasticdump --input http://172.19.0.3:9200/history_index --output history.mapping --type mapping
Sun, 02 Apr 2023 22:03:13 GMT | starting dump Sun, 02 Apr 2023 22:03:13 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:03:13 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:03:13 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:03:13 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:03:13 GMT | dump complete
$ cat history.mapping
{"history_index":{"mappings":{"properties":{"address":{"type":"keyword"},"date":{"type":"date"},"name":{"type":"keyword"}}}}}
Backup index data.
$ elasticdump --input http://172.19.0.3:9200/history --output history.data --type data --limit 1000
Sun, 02 Apr 2023 22:04:02 GMT | starting dump Sun, 02 Apr 2023 22:04:02 GMT | got 1000 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:04:02 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:02 GMT | got 1000 objects from source elasticsearch (offset: 1000) Sun, 02 Apr 2023 22:04:02 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:02 GMT | got 1000 objects from source elasticsearch (offset: 2000) Sun, 02 Apr 2023 22:04:02 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:02 GMT | got 1000 objects from source elasticsearch (offset: 3000) Sun, 02 Apr 2023 22:04:02 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:02 GMT | got 1000 objects from source elasticsearch (offset: 4000) Sun, 02 Apr 2023 22:04:03 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:03 GMT | got 1000 objects from source elasticsearch (offset: 5000) Sun, 02 Apr 2023 22:04:03 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:07 GMT | got 1000 objects from source elasticsearch (offset: 6000) Sun, 02 Apr 2023 22:04:07 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:07 GMT | got 1000 objects from source elasticsearch (offset: 7000) Sun, 02 Apr 2023 22:04:07 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:07 GMT | got 1000 objects from source elasticsearch (offset: 8000) Sun, 02 Apr 2023 22:04:07 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:04:07 GMT | got 996 objects from source elasticsearch (offset: 9000) Sun, 02 Apr 2023 22:04:07 GMT | sent 996 objects to destination file, wrote 996 Sun, 02 Apr 2023 22:04:07 GMT | got 0 objects from source elasticsearch (offset: 9996) Sun, 02 Apr 2023 22:04:07 GMT | Total Writes: 9996 Sun, 02 Apr 2023 22:04:07 GMT | dump complete
Inspect stored data.
$ head -1 history.data
{"_index":"history_index","_type":"_doc","_id":"h1jfQ4cB7JiRrXMOaKGR","_score":1,"_source":{"name":"Blog","address":"https://sleeplessbeastie.eu","date":"2020-01-05"}}
Restore single index
Inspect current indices.
$ curl "172.19.0.2:9200/_cat/indices?v=true"
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
Load index settings.
$ elasticdump --output http://172.19.0.2:9200/history_index --input history.settings --type settings
Sun, 02 Apr 2023 22:12:59 GMT | starting dump Sun, 02 Apr 2023 22:12:59 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:12:59 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:12:59 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:12:59 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:12:59 GMT | dump complete
Load index mappings.
$ elasticdump --output http://172.19.0.2:9200/history_index --input history.mapping --type mapping
Sun, 02 Apr 2023 22:13:17 GMT | starting dump Sun, 02 Apr 2023 22:13:17 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:13:17 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:13:17 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:13:17 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:13:17 GMT | dump complete
Load index aliases.
$ elasticdump --output http://172.19.0.2:9200/history_index --input history.alias --type alias
Sun, 02 Apr 2023 22:13:34 GMT | starting dump Sun, 02 Apr 2023 22:13:34 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:13:35 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:13:35 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:13:35 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:13:35 GMT | dump complete
Load index data.
$ elasticdump --output http://172.19.0.2:9200/history --input history.data --type data --limit 2000
Sun, 02 Apr 2023 22:14:10 GMT | starting dump Sun, 02 Apr 2023 22:14:10 GMT | got 2000 objects from source file (offset: 0) Sun, 02 Apr 2023 22:14:11 GMT | sent 2000 objects to destination elasticsearch, wrote 2000 Sun, 02 Apr 2023 22:14:11 GMT | got 2000 objects from source file (offset: 2000) Sun, 02 Apr 2023 22:14:12 GMT | sent 2000 objects to destination elasticsearch, wrote 2000 Sun, 02 Apr 2023 22:14:12 GMT | got 2000 objects from source file (offset: 4000) Sun, 02 Apr 2023 22:14:12 GMT | sent 2000 objects to destination elasticsearch, wrote 2000 Sun, 02 Apr 2023 22:14:12 GMT | got 2000 objects from source file (offset: 6000) Sun, 02 Apr 2023 22:14:12 GMT | sent 2000 objects to destination elasticsearch, wrote 2000 Sun, 02 Apr 2023 22:14:13 GMT | got 1996 objects from source file (offset: 8000) Sun, 02 Apr 2023 22:14:13 GMT | sent 1996 objects to destination elasticsearch, wrote 1996 Sun, 02 Apr 2023 22:14:13 GMT | got 0 objects from source file (offset: 9996) Sun, 02 Apr 2023 22:14:13 GMT | Total Writes: 9996 Sun, 02 Apr 2023 22:14:13 GMT | dump complete
Inspect indices after restore operation.
$ curl "172.19.0.2:9200/_cat/indices?v=true"
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size green open history_index 1XEnJ8WVSHCRs3VIfidwVg 1 0 9996 0 332.4kb 332.4kb
Backup multiple indices
Create backup directory.
$ mkdir elastic-20220403
Backup selected indices.
$ multielasticdump --direction dump \ --ignoreAlias false --ignoreTemplate false --ignoreSettings false --ignoreMapping false --ignoreData false \ --input http://172.19.0.3:9200 \ --output ./elastic-20220403 \ --match '^history_.*$|^bookmarks_.*$' \ --limit 1000 \ --debug false
Sun, 02 Apr 2023 22:21:40 GMT | We are performing : dump Sun, 02 Apr 2023 22:21:40 GMT | options: {"debug":false,"parallel":4,"match":"^history_.*$|^bookmarks_.*$","order":"asc","input":"http://172.19.0.3:9200","output":"./elastic-20220403","scrollId":null,"scrollTime":"10m","scroll-with-post":false,"timeout":null,"limit":1000,"offset":0,"size":-1,"direction":"dump","support-big-int":false,"big-int-fields":"","ignoreAnalyzer":true,"ignoreChildError":false,"ignoreData":false,"ignoreMapping":false,"ignoreSettings":false,"ignoreTemplate":false,"ignoreAlias":false,"ignoreType":[],"includeType":null,"interval":1000,"delete":false,"prefix":"","suffix":"","transform":null,"headers":null,"searchBody":null,"searchWithTemplate":null,"cert":null,"key":null,"pass":null,"ca":null,"tlsAuth":false,"input-cert":null,"input-key":null,"input-pass":null,"input-ca":null,"output-cert":null,"output-key":null,"output-pass":null,"output-ca":null,"httpAuthFile":null,"concurrency":1,"carryoverConcurrencyCount":true,"intervalCap":5,"concurrencyInterval":5000,"overwrite":false,"fsCompress":false,"awsChain":false,"awsAccessKeyId":null,"awsSecretAccessKey":null,"awsIniFileProfile":null,"awsService":null,"awsRegion":null,"awsUrlRegex":null,"s3AccessKeyId":null,"s3SecretAccessKey":null,"s3Region":null,"s3Endpoint":null,"s3SSLEnabled":true,"s3ForcePathStyle":false,"s3Compress":false,"s3ServerSideEncryption":null,"s3SSEKMSKeyId":null,"s3ACL":null,"quiet":false} Sun, 02 Apr 2023 22:21:40 GMT | dumping http://172.19.0.3:9200 to ./elastic-20220403/bookmarks_index.template.json Sun, 02 Apr 2023 22:21:41 GMT | starting dump Sun, 02 Apr 2023 22:21:41 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:41 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:41 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:41 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:41 GMT | dump complete Sun, 02 Apr 2023 22:21:41 GMT | dumping http://172.19.0.3:9200/bookmarks_index to ./elastic-20220403/bookmarks_index.settings.json Sun, 02 Apr 2023 22:21:41 GMT | dumping http://172.19.0.3:9200 to ./elastic-20220403/history_index.template.json Sun, 02 Apr 2023 22:21:42 GMT | starting dump Sun, 02 Apr 2023 22:21:42 GMT | starting dump Sun, 02 Apr 2023 22:21:42 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:42 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:42 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:42 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:42 GMT | dump complete Sun, 02 Apr 2023 22:21:42 GMT | dumping http://172.19.0.3:9200/bookmarks_index to ./elastic-20220403/bookmarks_index.mapping.json Sun, 02 Apr 2023 22:21:42 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:42 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:42 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:42 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:42 GMT | dump complete Sun, 02 Apr 2023 22:21:42 GMT | dumping http://172.19.0.3:9200/history_index to ./elastic-20220403/history_index.settings.json Sun, 02 Apr 2023 22:21:43 GMT | starting dump Sun, 02 Apr 2023 22:21:43 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:43 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:43 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:43 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:43 GMT | dump complete Sun, 02 Apr 2023 22:21:43 GMT | analyzer http://172.19.0.3:9200/bookmarks_index to ./elastic-20220403/bookmarks_index.alias.json Sun, 02 Apr 2023 22:21:43 GMT | starting dump Sun, 02 Apr 2023 22:21:43 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:43 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:43 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:43 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:43 GMT | dump complete Sun, 02 Apr 2023 22:21:43 GMT | dumping http://172.19.0.3:9200/history_index to ./elastic-20220403/history_index.mapping.json Sun, 02 Apr 2023 22:21:44 GMT | starting dump Sun, 02 Apr 2023 22:21:44 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:44 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:44 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:44 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:44 GMT | dump complete Sun, 02 Apr 2023 22:21:44 GMT | dumping http://172.19.0.3:9200/bookmarks_index to ./elastic-20220403/bookmarks_index.json Sun, 02 Apr 2023 22:21:44 GMT | starting dump Sun, 02 Apr 2023 22:21:44 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:44 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:44 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:44 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:44 GMT | dump complete Sun, 02 Apr 2023 22:21:44 GMT | analyzer http://172.19.0.3:9200/history_index to ./elastic-20220403/history_index.alias.json Sun, 02 Apr 2023 22:21:45 GMT | starting dump Sun, 02 Apr 2023 22:21:45 GMT | starting dump Sun, 02 Apr 2023 22:21:45 GMT | got 1000 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:45 GMT | got 1 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:45 GMT | sent 1 objects to destination file, wrote 1 Sun, 02 Apr 2023 22:21:45 GMT | got 0 objects from source elasticsearch (offset: 1) Sun, 02 Apr 2023 22:21:45 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:21:45 GMT | dump complete Sun, 02 Apr 2023 22:21:45 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:45 GMT | dumping http://172.19.0.3:9200/history_index to ./elastic-20220403/history_index.json Sun, 02 Apr 2023 22:21:46 GMT | got 24 objects from source elasticsearch (offset: 1000) Sun, 02 Apr 2023 22:21:46 GMT | sent 24 objects to destination file, wrote 24 Sun, 02 Apr 2023 22:21:46 GMT | got 0 objects from source elasticsearch (offset: 1024) Sun, 02 Apr 2023 22:21:46 GMT | Total Writes: 1024 Sun, 02 Apr 2023 22:21:46 GMT | dump complete Sun, 02 Apr 2023 22:21:46 GMT | starting dump Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 0) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 1000) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 2000) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 3000) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 4000) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:47 GMT | got 1000 objects from source elasticsearch (offset: 5000) Sun, 02 Apr 2023 22:21:47 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:52 GMT | got 1000 objects from source elasticsearch (offset: 6000) Sun, 02 Apr 2023 22:21:52 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:52 GMT | got 1000 objects from source elasticsearch (offset: 7000) Sun, 02 Apr 2023 22:21:52 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:52 GMT | got 1000 objects from source elasticsearch (offset: 8000) Sun, 02 Apr 2023 22:21:52 GMT | sent 1000 objects to destination file, wrote 1000 Sun, 02 Apr 2023 22:21:52 GMT | got 996 objects from source elasticsearch (offset: 9000) Sun, 02 Apr 2023 22:21:52 GMT | sent 996 objects to destination file, wrote 996 Sun, 02 Apr 2023 22:21:52 GMT | got 0 objects from source elasticsearch (offset: 9996) Sun, 02 Apr 2023 22:21:52 GMT | Total Writes: 9996 Sun, 02 Apr 2023 22:21:52 GMT | dump complete Sun, 02 Apr 2023 22:22:02 GMT | dumping all done Sun, 02 Apr 2023 22:22:02 GMT | bye
Inspect created backup.
$ ls -l elastic-20220403/
total 1908 -rw-rw-r-- 1 milosz milosz 57 Apr 3 00:21 bookmarks_index.alias.json -rw-rw-r-- 1 milosz milosz 238808 Apr 3 00:21 bookmarks_index.json -rw-rw-r-- 1 milosz milosz 166 Apr 3 00:21 bookmarks_index.mapping.json -rw-rw-r-- 1 milosz milosz 109 Apr 3 00:21 bookmarks_index.settings.json -rw-rw-r-- 1 milosz milosz 1226 Apr 3 00:21 bookmarks_index.template.json -rw-rw-r-- 1 milosz milosz 53 Apr 3 00:21 history_index.alias.json -rw-rw-r-- 1 milosz milosz 1679328 Apr 3 00:21 history_index.json -rw-rw-r-- 1 milosz milosz 126 Apr 3 00:21 history_index.mapping.json -rw-rw-r-- 1 milosz milosz 107 Apr 3 00:21 history_index.settings.json -rw-rw-r-- 1 milosz milosz 1226 Apr 3 00:21 history_index.template.json
$ cat elastic-20220403/bookmarks_index.mapping.json
{"bookmarks_index":{"mappings":{"properties":{"address":{"type":"keyword"},"date":{"type":"date"},"name":{"type":"keyword"},"tag":{"type":"keyword","store":true}}}}}
Restore backup.
$ multielasticdump --direction load \ --ignoreAlias false --ignoreTemplate false --ignoreSettings false --ignoreMapping false --ignoreData false \ --output http://172.19.0.2:9200 \ --input ./elastic-20220403 \ --match '^history_.*$|^bookmarks_.*$' \ --limit 1000 \ --debug false
Sun, 02 Apr 2023 22:24:24 GMT | We are performing : load Sun, 02 Apr 2023 22:24:24 GMT | options: {"debug":false,"parallel":4,"match":"^history_.*$|^bookmarks_.*$","order":"asc","input":"./elastic-20220403","output":"http://172.19.0.2:9200","scrollId":null,"scrollTime":"10m","scroll-with-post":false,"timeout":null,"limit":1000,"offset":0,"size":-1,"direction":"load","support-big-int":false,"big-int-fields":"","ignoreAnalyzer":true,"ignoreChildError":false,"ignoreData":false,"ignoreMapping":false,"ignoreSettings":false,"ignoreTemplate":false,"ignoreAlias":false,"ignoreType":[],"includeType":null,"interval":1000,"delete":false,"prefix":"","suffix":"","transform":null,"headers":null,"searchBody":null,"searchWithTemplate":null,"cert":null,"key":null,"pass":null,"ca":null,"tlsAuth":false,"input-cert":null,"input-key":null,"input-pass":null,"input-ca":null,"output-cert":null,"output-key":null,"output-pass":null,"output-ca":null,"httpAuthFile":null,"concurrency":1,"carryoverConcurrencyCount":true,"intervalCap":5,"concurrencyInterval":5000,"overwrite":false,"fsCompress":false,"awsChain":false,"awsAccessKeyId":null,"awsSecretAccessKey":null,"awsIniFileProfile":null,"awsService":null,"awsRegion":null,"awsUrlRegex":null,"s3AccessKeyId":null,"s3SecretAccessKey":null,"s3Region":null,"s3Endpoint":null,"s3SSLEnabled":true,"s3ForcePathStyle":false,"s3Compress":false,"s3ServerSideEncryption":null,"s3SSEKMSKeyId":null,"s3ACL":null,"quiet":false} Sun, 02 Apr 2023 22:24:24 GMT | list of indexes["bookmarks_index","history_index"] Sun, 02 Apr 2023 22:24:24 GMT | Working on bookmarks_index Sun, 02 Apr 2023 22:24:24 GMT | indexing template ./elastic-20220403/bookmarks_index.template.json to http://172.19.0.2:9200/bookmarks_index Sun, 02 Apr 2023 22:24:25 GMT | starting dump Sun, 02 Apr 2023 22:24:25 GMT | Working on history_index Sun, 02 Apr 2023 22:24:25 GMT | indexing template ./elastic-20220403/history_index.template.json to http://172.19.0.2:9200/history_index Sun, 02 Apr 2023 22:24:25 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:26 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:26 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:26 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:26 GMT | dump complete Sun, 02 Apr 2023 22:24:26 GMT | indexing settings ./elastic-20220403/bookmarks_index.settings.json to http://172.19.0.2:9200/bookmarks_index Sun, 02 Apr 2023 22:24:26 GMT | starting dump Sun, 02 Apr 2023 22:24:27 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:27 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:27 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:27 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:27 GMT | dump complete Sun, 02 Apr 2023 22:24:27 GMT | indexing settings ./elastic-20220403/history_index.settings.json to http://172.19.0.2:9200/history_index Sun, 02 Apr 2023 22:24:27 GMT | starting dump Sun, 02 Apr 2023 22:24:27 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:27 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:27 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:27 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:27 GMT | dump complete Sun, 02 Apr 2023 22:24:27 GMT | indexing mapping ./elastic-20220403/bookmarks_index.mapping.json to http://172.19.0.2:9200/bookmarks_index Sun, 02 Apr 2023 22:24:28 GMT | starting dump Sun, 02 Apr 2023 22:24:28 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:28 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:28 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:28 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:28 GMT | dump complete Sun, 02 Apr 2023 22:24:28 GMT | indexing mapping ./elastic-20220403/history_index.mapping.json to http://172.19.0.2:9200/history_index Sun, 02 Apr 2023 22:24:28 GMT | starting dump Sun, 02 Apr 2023 22:24:28 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:28 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:28 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:28 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:28 GMT | dump complete Sun, 02 Apr 2023 22:24:28 GMT | indexing alias ./elastic-20220403/bookmarks_index.alias.json to http://172.19.0.2:9200/bookmarks_index Sun, 02 Apr 2023 22:24:29 GMT | starting dump Sun, 02 Apr 2023 22:24:29 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:29 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:29 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:29 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:29 GMT | dump complete Sun, 02 Apr 2023 22:24:29 GMT | indexing alias ./elastic-20220403/history_index.alias.json to http://172.19.0.2:9200/history_index Sun, 02 Apr 2023 22:24:29 GMT | starting dump Sun, 02 Apr 2023 22:24:29 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:30 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:30 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:30 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:30 GMT | dump complete Sun, 02 Apr 2023 22:24:30 GMT | indexing data ./elastic-20220403/bookmarks_index.json to http://172.19.0.2:9200/bookmarks_index Sun, 02 Apr 2023 22:24:30 GMT | starting dump Sun, 02 Apr 2023 22:24:30 GMT | got 1 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:30 GMT | sent 1 objects to destination elasticsearch, wrote 1 Sun, 02 Apr 2023 22:24:30 GMT | got 0 objects from source file (offset: 1) Sun, 02 Apr 2023 22:24:30 GMT | Total Writes: 1 Sun, 02 Apr 2023 22:24:30 GMT | dump complete Sun, 02 Apr 2023 22:24:30 GMT | indexing data ./elastic-20220403/history_index.json to http://172.19.0.2:9200/history_index Sun, 02 Apr 2023 22:24:31 GMT | starting dump Sun, 02 Apr 2023 22:24:31 GMT | got 1000 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:31 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:31 GMT | got 24 objects from source file (offset: 1000) Sun, 02 Apr 2023 22:24:31 GMT | sent 24 objects to destination elasticsearch, wrote 24 Sun, 02 Apr 2023 22:24:31 GMT | got 0 objects from source file (offset: 1024) Sun, 02 Apr 2023 22:24:31 GMT | Total Writes: 1024 Sun, 02 Apr 2023 22:24:31 GMT | dump complete Sun, 02 Apr 2023 22:24:32 GMT | starting dump Sun, 02 Apr 2023 22:24:32 GMT | got 1000 objects from source file (offset: 0) Sun, 02 Apr 2023 22:24:32 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:32 GMT | got 1000 objects from source file (offset: 1000) Sun, 02 Apr 2023 22:24:32 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:33 GMT | got 1000 objects from source file (offset: 2000) Sun, 02 Apr 2023 22:24:33 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:33 GMT | got 1000 objects from source file (offset: 3000) Sun, 02 Apr 2023 22:24:33 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:33 GMT | got 1000 objects from source file (offset: 4000) Sun, 02 Apr 2023 22:24:33 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:33 GMT | got 1000 objects from source file (offset: 5000) Sun, 02 Apr 2023 22:24:34 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:37 GMT | got 1000 objects from source file (offset: 6000) Sun, 02 Apr 2023 22:24:37 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:37 GMT | got 1000 objects from source file (offset: 7000) Sun, 02 Apr 2023 22:24:37 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:37 GMT | got 1000 objects from source file (offset: 8000) Sun, 02 Apr 2023 22:24:37 GMT | sent 1000 objects to destination elasticsearch, wrote 1000 Sun, 02 Apr 2023 22:24:37 GMT | got 996 objects from source file (offset: 9000) Sun, 02 Apr 2023 22:24:38 GMT | sent 996 objects to destination elasticsearch, wrote 996 Sun, 02 Apr 2023 22:24:38 GMT | got 0 objects from source file (offset: 9996) Sun, 02 Apr 2023 22:24:38 GMT | Total Writes: 9996 Sun, 02 Apr 2023 22:24:38 GMT | dump complete Sun, 02 Apr 2023 22:24:48 GMT | indexing all done Sun, 02 Apr 2023 22:24:48 GMT | bye
You can skip match
parameter in this particular case.