# How to reindex from es cluster1 to es cluster2 with Spark

**URL:** <https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [October 26, 2016, 7:22pm UTC](https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049 "2016-10-26T19:22:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_Wang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jack_wang/32/4886_2.png) [@Jack\_Wang](https://discuss.elastic.co/u/Jack_Wang)\
**Post date:** [October 26, 2016, 7:22pm UTC](https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049/1 "2016-10-26T19:22:24Z")

</div>

I have two ES clusters, I wanna reindex the data from cluster1 to cluster2, but I found I only can setup one SparkContext with one ES cluster, such as:  
var sparkConf:SparkConf = new SparkConf().setAppName("EsReIndex")  
sparkConf.set("es.nodes", “node1:9200")

So how can I implement the data reindex between two ES clusters.

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [October 27, 2016, 3:07am UTC](https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049/2 "2016-10-27T03:07:54Z")

</div>

how about just using Logstash ( An oldie but goodie)

[https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-elasticsearch.html](https://www.elastic.co/guide/en/logstash/2.4/plugins-inputs-elasticsearch.html)

input {  
elasticsearch {  
.....details for cluster 1  
}  
}  
output{  
eleasticsearch {  
...... Details for cluster2  
}  
}

this is an old how we did it in the old 1.3 days , I know some people keep all their documents in Kafka, and by just resetting the topic offset you can replay the whole Topic.

---

<div class="post-metadata">

**Author:** ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)\
**Post date:** [October 27, 2016, 8:11pm UTC](https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049/3 "2016-10-27T20:11:16Z")

</div>

@Jack_Wang Another option you could try is the [ReIndex API](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-reindex.html) in Elasticsearch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:22pm UTC](https://discuss.elastic.co/t/how-to-reindex-from-es-cluster1-to-es-cluster2-with-spark/64049/4 "2017-07-06T13:22:46Z")

</div>


