# How to index heterogeneous JSON Array as value in Elastic Search

**URL:** <https://discuss.elastic.co/t/how-to-index-heterogeneous-json-array-as-value-in-elastic-search/29128>\
**Category:** Elasticsearch\
**Created:** [September 11, 2015, 11:07am UTC](https://discuss.elastic.co/t/how-to-index-heterogeneous-json-array-as-value-in-elastic-search/29128 "2015-09-11T11:07:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apt275](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@apt275](https://discuss.elastic.co/u/apt275)\
**Post date:** [September 11, 2015, 11:07am UTC](https://discuss.elastic.co/t/how-to-index-heterogeneous-json-array-as-value-in-elastic-search/29128/1 "2015-09-11T11:07:57Z")

</div>

Can Elastic search index fields like

"key": [  
14.0,  
"somestring"  
]

if i try to ingest this data, i get this error  
org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest: Found unrecoverable error [Bad Request(400) - [WriteFailureException; nested: MapperParsingException[failed to parse [FIXMessage.key]]; nested: NumberFormatException[For input string: "somestring"]; ]]; Bailing out..

Please also refer to

> <https://stackoverflow.com/questions/32513043/elastic-search-json-stringjsonobject-indexing/32514161#32514161>

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [September 11, 2015, 1:42pm UTC](https://discuss.elastic.co/t/how-to-index-heterogeneous-json-array-as-value-in-elastic-search/29128/2 "2015-09-11T13:42:04Z")

</div>

As pointed out in the answer on StackOverflow, the type of all elements in the array must be the same. If you have not provided an explicit mapping, Elasticsearch will determine the type based on the first value it sees, in this case a float, and that will make indexing the string fail.

---

<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 5, 2017, 11:50pm UTC](https://discuss.elastic.co/t/how-to-index-heterogeneous-json-array-as-value-in-elastic-search/29128/3 "2017-07-05T23:50:43Z")

</div>


