# Mixed arrays and doubles in elasticsearch (jdbc importer)

**URL:** <https://discuss.elastic.co/t/mixed-arrays-and-doubles-in-elasticsearch-jdbc-importer/68702>\
**Category:** Elasticsearch\
**Created:** [December 12, 2016, 11:14am UTC](https://discuss.elastic.co/t/mixed-arrays-and-doubles-in-elasticsearch-jdbc-importer/68702 "2016-12-12T11:14:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars2](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@Lars2](https://discuss.elastic.co/u/Lars2)\
**Post date:** [December 12, 2016, 11:14am UTC](https://discuss.elastic.co/t/mixed-arrays-and-doubles-in-elasticsearch-jdbc-importer/68702/1 "2016-12-12T11:14:36Z")

</div>

Hey,

I have a field in ElasticSearch. Sometimes it is filled by one double (for example: 18). But it could also have multiple doubles (for example: 18 and 19).

Elasticsearch automatically converts the record swith multiple values to an array. But the record with one value stays a double.

Now the problem is that I am trying to retrieve the record from elaticsearch using Nest. But i am getting the following error:  
`Error converting value 18 to type 'System.Int32[]'. Path 'hits.hits[0]._source.typegroups', line 1, position 10673.`  
This is because it is trying to map to a record with datatype int[] when in fact it could also be int.

Is there any way I can save all values to elastic as an array (even if there is only one). Or is there any way to retrieve the values to my .NET application.

I know i could ad brackets when putting data in Elasticsearch (for example [18]) so it would always be an array. But i am feeding my data with the jdbc importer.

thanks in advance.

---

<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 9, 2017, 11:15am UTC](https://discuss.elastic.co/t/mixed-arrays-and-doubles-in-elasticsearch-jdbc-importer/68702/2 "2017-01-09T11:15:20Z")

</div>

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