# Pyspark write list type to ES

**URL:** https://discuss.elastic.co/t/pyspark-write-list-type-to-es/43944
**Category:** Elasticsearch
**Tags:** es-hadoop
**Created:** [March 9, 2016, 8:38pm UTC](https://discuss.elastic.co/t/pyspark-write-list-type-to-es/43944 "2016-03-09T20:38:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Joseph\_Gartner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joseph_gartner/32/8389_2.png) [@Joseph\_Gartner](https://discuss.elastic.co/u/Joseph_Gartner)
#### Post date: [March 9, 2016, 8:38pm UTC](https://discuss.elastic.co/t/pyspark-write-list-type-to-es/43944/1 "2016-03-09T20:38:18Z")

</div>

I'm attempting to write data to elasticsearch using pyspark. I can successfully write using the "saveAsNewAPIHadoopFile" api for most cases, however, when one of the json objects is a list, it throws an error:  
`SparkException: Data of type java.util.ArrayList cannot be used`

ES can ingest lists via other means, and it is a bit cumbersome to transform my list to another state. Any advice would be useful. For refference, I am using  
ElasticSearch 1.7.3  
Spark 1.5.0-cdh5.5.1,  
Hadoop 2.6.0-cdh5.5.1  
ES-Hadoop connector: elasticsearch-hadoop-2.2.0.jar

---

<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: [March 12, 2016, 2:16pm UTC](https://discuss.elastic.co/t/pyspark-write-list-type-to-es/43944/2 "2016-03-12T14:16:56Z")

</div>

From the docs, [Handling array/multi-values field](https://www.elastic.co/guide/en/elasticsearch/hadoop/current/mapping.html#mapping-multi-values)

---

<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:25pm UTC](https://discuss.elastic.co/t/pyspark-write-list-type-to-es/43944/3 "2017-07-06T13:25:46Z")

</div>


