Closed

Description
NEST/Elasticsearch.Net version: 6.2.0
Elasticsearch version: 6.x
Description of the problem including expected versus actual behavior:
HandleNestTypesOnSourceJsonConverter does not serialize/deserialize the join field as expected.
"myparent" vs "\"myparent\""
Steps to reproduce:
- Check attached source code
var parentDocument = new MyParent
{
Id = 1,
ParentProperty = "a parent prop",
MyJoinField = "myparent"
};
var settings = new JsonSerializerSettings();
settings.Converters.Add(new HandleNestTypesOnSourceJsonConverter(((IConnectionSettingsValues)connectionSettings).RequestResponseSerializer));
var json01 = Newtonsoft.Json.JsonConvert.SerializeObject(parentDocument, Formatting.Indented, settings);
var back01 = Newtonsoft.Json.JsonConvert.DeserializeObject<MyParent>(json01, settings);
var json02 = Newtonsoft.Json.JsonConvert.SerializeObject(back01, Formatting.Indented, settings);
Console.WriteLine($"JSON01: {json01}");
Console.WriteLine($"JSON02: {json02}");
- Result
JSON01: {
"ParentProperty": "a parent prop",
"Id": 1,
"MyJoinField": "myparent"
}
JSON02: {
"ParentProperty": "a parent prop",
"Id": 1,
"MyJoinField": "\"myparent\""
}
Note: This is causing a lot of troubles for as as we use to serialize/deserialize to send documents between micro services.
Metadata
Metadata
Assignees
Labels
No labels