-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdump.sh
More file actions
executable file
·49 lines (40 loc) · 1.77 KB
/
dump.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Check if password and dump path arguments were provided
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Error: Please provide both the Elasticsearch password and the dump path."
echo "Usage: $0 <password> <dump_path>"
exit 1
fi
# Check if the dump path is a directory
if [ ! -d "$2" ]; then
echo "Error: The provided dump path '$2' is not a directory."
exit 1
fi
# Dump songs index
docker run --rm --net=host -v "$(realpath "$2")":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/songs \
--output=/tmp/songs_mapping.json \
--type=mapping
docker run --rm --net=host -v "$2":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/songs \
--output=/tmp/songs_data.json \
--type=data
# Dump corpuses index
docker run --rm --net=host -v "$2":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/corpuses \
--output=/tmp/corpuses_mapping.json \
--type=mapping
docker run --rm --net=host -v "$2":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/corpuses \
--output=/tmp/corpuses_data.json \
--type=data
# Dump audio index
docker run --rm --net=host -v "$2":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/audio \
--output=/tmp/audio_mapping.json \
--type=mapping
docker run --rm --net=host -v "$2":/tmp -e NODE_TLS_REJECT_UNAUTHORIZED=0 -ti elasticdump/elasticsearch-dump \
--input=https://elastic:$1@localhost:9200/audio \
--output=/tmp/audio_data.json \
--type=data
echo "Dump complete. Check '$2' for the output files."