Mixed arrays and doubles in elasticsearch (jdbc importer)



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.

(system) #2

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