# Is there a way to reindex to remote ES cluster with es-spark support?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-reindex-to-remote-es-cluster-with-es-spark-support/109009>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [November 24, 2017, 10:20am UTC](https://discuss.elastic.co/t/is-there-a-way-to-reindex-to-remote-es-cluster-with-es-spark-support/109009 "2017-11-24T10:20:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)\
**Post date:** [November 24, 2017, 10:20am UTC](https://discuss.elastic.co/t/is-there-a-way-to-reindex-to-remote-es-cluster-with-es-spark-support/109009/1 "2017-11-24T10:20:08Z")

</div>

below is the action I want to take:  
SparkConf rconf = new SparkConf()  
SparkConf wconf = new SparkConf()  
JavaSparkContext rjsc = new JavaSparkContext(rconf);  
JavaSparkContext wjsc = new JavaSparkContext(wconf);  
JavaRDD\<Map\<String, Object\>\> esRDD = JavaEsSpark.esRDD(rjsc, "").values();  
JavaRDD\<Map\<String, Object\>\> esRDD2 = wjsc.union(esRDD);  
JavaEsSpark.saveToEs(esRDD2, "xx");  
but spark won't support 2 context per application.  
so I'd like to know is there a way to do this easily?

---

<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:** [December 13, 2017, 6:05pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-reindex-to-remote-es-cluster-with-es-spark-support/109009/2 "2017-12-13T18:05:33Z")

</div>

You could use a single context and provide the settings just at the RDD level instead of at the context level. We don't really test in scenarios where there are multiple clusters. If you run into any issues feel free to bring them up here and we'll try to help you work through them.

---

<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:** [January 10, 2018, 6:06pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-reindex-to-remote-es-cluster-with-es-spark-support/109009/3 "2018-01-10T18:06:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
