I have a C# class that include a Dictionary (this is just one row of the class)
public Dictionary<string, double?> Resultat { get; set; }
When I created the Index I created that as a Collection of complex type
Collection(Edm.ComplexType)
key (Edm.String)
value (Edm.Double)
I use the C# native library to post documents to the search index and when I run the code I'll get an error stating that it looks for a start marker. I figured out that Azure Cognitive Search serializer converts the Dictionary to a json class instead of an json array.
the result looks a bit like:
{
"key1": "value1",
"key2": "value2"
}
but Cognitive Search expects the data to look like:
[
{"key1":"value1"},
{"key2":"value2"}
]
Since the dictionary is dynamic in both count and keys (unknown counts, and unknown keys) it cannot create the field as a Edm.Complex type.
Is there any way to send serializer instructions to Cognitive Search to serialize Dictionarys to arrays instead of objects?? Are there any other solutions?