Can't save a List<int?> on Elasticsearch 5.6.5

I've been playing with NEST 5.6.5 to see how it's treating the Nullable types in Elasticsearch.

While serializing a NEST request I've noticed that for int? it's just a number and when it's null the value is not sent.
When I use a List<int?> the mapping changes to an object with the properties: hasValue and value.
The problem is that this time the values are sent as integers or null, instead of {hasValue:true, value:123} or {hasValue:false} and I'm getting a serialization error.

What should I do to be able to save a List<int?> ?
From the mapping it's obvious that this weird scenario should be supported so why it's not working?

Take a look at the mapping docs as I think it'll answer your questions. You likely want to use automapping to map the List<int?> as the integer data type.

I used automapping.

Can you provide a reproducible example please? Also, what version of Elasticsearch are you running against?

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