# Read data with Spark, how to control coalesce partitions?

**URL:** <https://discuss.elastic.co/t/read-data-with-spark-how-to-control-coalesce-partitions/73385>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [January 31, 2017, 3:23pm UTC](https://discuss.elastic.co/t/read-data-with-spark-how-to-control-coalesce-partitions/73385 "2017-01-31T15:23:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [January 31, 2017, 3:23pm UTC](https://discuss.elastic.co/t/read-data-with-spark-how-to-control-coalesce-partitions/73385/1 "2017-01-31T15:23:30Z")

</div>

Reading data with Spark (1.6) to elasticseach (2.4) in Java with

```
JavaEsSpark.esRDD

```

I am wondering how `coalesce` is achieved ? (I mean how distribution is done ?)

If it's possible to select a field as distribution key ?

Thanks you,

---

<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:** [February 28, 2017, 3:23pm UTC](https://discuss.elastic.co/t/read-data-with-spark-how-to-control-coalesce-partitions/73385/2 "2017-02-28T15:23:46Z")

</div>

Closed on February 28, 2017, 3:23pm UTC

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