Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ local.properties
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.idea/
*.iws
*.iml
*.ipr

# User-specific stuff
.idea/**/workspace.xml
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ $ mvn clean install
$ ./run.sh
```

## Migrate elasticsearch data

To migrate the collected data from our local elasticsearch to the cloud elasticsearch we can use the following command:
```
$ ./migrate-elasticsearch-data.sh localIndex cloudElasticPath
```
As first parameter we need to insert the local index to migrate and as second parameter the elastic cloud index path adding the user and password.

Example:
```
$ ./migrate-elasticsearch-data.sh sampleIndex https://user:password@elasticCloudHost/sampleIndex
```

## Built With

* [Spring Framework](https://spring.io/) - The framework used
Expand Down
25 changes: 25 additions & 0 deletions migrate-elasticsearch-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
localElastic=$(docker ps | grep 'docker.elastic.co/elasticsearch/elasticsearch' | awk '{print $1}')

if [[ "$localElastic" != "" ]]
then
from="http://elasticsearch:9200/$1"
to=$2
echo "Moving data from: $from to $to"

docker run --name=elasticsearch-dump --network=docker_elk --link=${localElastic}:elasticsearch taskrabbit/elasticsearch-dump --input=${from} \
--output=${to} \
--type=data

echo "Stopped docker container:" $(docker stop elasticsearch-dump)
echo "Removed docker container:" $(docker rm elasticsearch-dump)

echo "**********************************************************************************"
echo "******************** Imported data to cloud elasticsearch! :) ********************"
echo "**********************************************************************************"

else
echo "**********************************************************************************"
echo "************************** Local elastic is not running **************************"
echo "**********************************************************************************"
fi