# Index JSONArray into elastcisearch

**URL:** <https://discuss.elastic.co/t/index-jsonarray-into-elastcisearch/68751>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [December 12, 2016, 6:49pm UTC](https://discuss.elastic.co/t/index-jsonarray-into-elastcisearch/68751 "2016-12-12T18:49:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmalinip](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@nmalinip](https://discuss.elastic.co/u/nmalinip)\
**Post date:** [December 12, 2016, 6:49pm UTC](https://discuss.elastic.co/t/index-jsonarray-into-elastcisearch/68751/1 "2016-12-12T18:49:48Z")

</div>

Hi,

My requirement is to index a JSONArray as one of the field value into elstic search using spark...I am trying to do the following, but no luck..

```
   val resMap = scala.collection.mutable.Map[String,JSONArray]()
   for(....){
   resMap += ("tagName"->k,"objectids"->v) ( Add few rows here)
   }
      val saveRdd = sc.parallelize(Seq(resMap))
   val esconf = Map("es.nodes" -> getConf(ELASTICSEARCH).split(":")(0), "es.port" -> "9200","es.index.auto.create" -> "true", "es.mapping.id" -> "tagName")
        

     EsSpark.saveToEs(saveRdd,customerId+"test/objectTags",esconf)

```

But i am getting following exception..

```
         org.elasticsearch.hadoop.serialization.EsHadoopSerializationException: Cannot handle type [class org.codehaus.jettison.json.JSONArray] within type [class scala.collection.mutable.HashMap]

```

Any best way to index this type of data. We are using spark 1.6.2 and elasticearch 2.3.4

Thanks,  
Malini

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [December 13, 2016, 10:53am UTC](https://discuss.elastic.co/t/index-jsonarray-into-elastcisearch/68751/2 "2016-12-13T10:53:19Z")

</div>

Hi,

Maybe this question should better be asked in the [ESHadoop Forum](https://discuss.elastic.co/c/elasticsearch-and-hadoop)? I think you can move it there if you like.

---

<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, 2017, 10:53am UTC](https://discuss.elastic.co/t/index-jsonarray-into-elastcisearch/68751/3 "2017-01-10T10:53:56Z")

</div>

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