# Calling esRDD in a transformation method causes Task not serializable

**URL:** <https://discuss.elastic.co/t/calling-esrdd-in-a-transformation-method-causes-task-not-serializable/40078>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [January 26, 2016, 1:52am UTC](https://discuss.elastic.co/t/calling-esrdd-in-a-transformation-method-causes-task-not-serializable/40078 "2016-01-26T01:52:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [January 27, 2016, 8:38pm UTC](https://discuss.elastic.co/t/calling-esrdd-in-a-transformation-method-causes-task-not-serializable/40078/2 "2016-01-27T20:38:12Z")

</div>

As I've mentioned in another [thread](https://discuss.elastic.co/t/esrdd-not-returning-script-fields-values/40077/2), you are being quite cryptic in your questions so it's hard to understand what the issue is.

Task not serializable it's a common issue in Spark cause by the fact that you are passing around code which is not serializable. And yes, nesting an `RDD` of any kind qualify as such - take a look into the Spark docs, it's easy to get around it by keeping the data point outside your code and trying to leverage as much as possible the `RDD` functions.  
Note that an `RDD` is a distributed collection in the end - it acts like one but it's actually a proxy to a distributed job.

---

_[View the full topic](https://discuss.elastic.co/t/calling-esrdd-in-a-transformation-method-causes-task-not-serializable/40078)._
