# Error in adding Nested objects using Spark on Es-Index

**URL:** <https://discuss.elastic.co/t/error-in-adding-nested-objects-using-spark-on-es-index/143694>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [August 9, 2018, 12:56pm UTC](https://discuss.elastic.co/t/error-in-adding-nested-objects-using-spark-on-es-index/143694 "2018-08-09T12:56:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TANISHQ\_BATRA](https://avatars.discourse-cdn.com/v4/letter/t/eada6e/32.png) [@TANISHQ\_BATRA](https://discuss.elastic.co/u/TANISHQ_BATRA)\
**Post date:** [August 9, 2018, 12:56pm UTC](https://discuss.elastic.co/t/error-in-adding-nested-objects-using-spark-on-es-index/143694/1 "2018-08-09T12:56:02Z")

</div>

Caused by: java.lang.ClassCastException: org.apache.spark.sql.catalyst.expressions.GenericRowWithSchema cannot be cast to scala.Tuple2

Details: Es version-6.3  
Incoming object example  
{  
"note":  
{  
"a":"1",  
"b':"2"  
}  
}

//Es properties used:  
.option("es.mapping.id", "note.a")  
.option("es.write.operation", "upsert")  
.option(ConfigurationOptions.ES\_UPDATE\_SCRIPT\_INLINE, "ctx.\_source.notefield.add(params.param1)")  
.option(ConfigurationOptions.ES\_UPDATE\_SCRIPT\_PARAMS, "param1:note")  
.option("es.write.operation", "upsert")

//the "notefield" is declared as nested in mapping at ES.  
Any suggestions

---

<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:** [September 6, 2018, 12:56pm UTC](https://discuss.elastic.co/t/error-in-adding-nested-objects-using-spark-on-es-index/143694/2 "2018-09-06T12:56:06Z")

</div>

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