michael lother
michael lother

Reputation: 139

To copy an index from one machine to another in elasticsearch

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

Answers (3)

Vineeth Mohan
Vineeth Mohan

Reputation: 19283

I can see 3 options here

  1. Snapshot/Restore - You can move your data across geographical locations.
  2. Logstash reindex - As pointed out by Val
  3. Stream2ES - This is a more simpler solution

Upvotes: 1

Prashant Agrawal
Prashant Agrawal

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

Val
Val

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

Related Questions