Reputation: 139
I have some indexes in one of my machines. I need to copy them to another machine, how can i do that in elasticsearch. I did get some good documentation here, but since im an newbie to elasticsearch ecosystem and since im toying with lesser data indices, I thought I would use some plugins or ways which would be less time consuming.
Upvotes: 1
Views: 2658
Reputation: 19283
I can see 3 options here
Upvotes: 1
Reputation: 381
You can use Snapshot and restore feature as well, where you can take snapshot (backup) of one index and then can Restore to somewhere else.
Just have a look at https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html
Upvotes: 1
Reputation: 217554
I would use Logstash with an elasticsearch
input plugin and an elasticsearch
output plugin.
After installing Logstash, you can create a configuration file copy.conf
that looks like this:
input {
elasticsearch {
hosts => "localhost:9200" <--- source ES host
index => "source_index"
}
}
filter {
mutate {
remove_field => [ "@version", "@timestamp" ] <--- remove added junk
}
}
output {
elasticsearch {
host => "localhost" <--- target ES host
port => 9200
protocol => "http"
manage_template => false
index => "target_index"
document_id => "%{id}" <--- name of your ID field
workers => 1
}
}
And then after setting the correct values (source/target host + source/target index), you can run this with bin/logstash -f copy.conf
Upvotes: 2