I have indexed an object defined as such:
public class CourseOffering
{
public int CourseId { get; set; }
public string Title { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public ICollection<TimeBlock> TimeBlocks { get; set; }
}
The TimeBlock class is defined as:
public class TimeBlock
{
public DayOfWeek Day { get; set; }
public LocalTime StartTime { get; set; }
public LocalTime EndTime { get; set; }
}
When calling the dynamic search method, everything works fine (presumably because it doesn't know what to deserialize to). The results are returned correctly.
When calling the generic search method and passing in the CourseOffering type, the default serializer has problems deserializing the LocalTime objects. I get the following JsonReaderException:
Error reading integer. Unexpected token: StartObject. Path 'hits.hits[0]._source.timeBlocks[0].startTime', line 1, position 655.
I have tried adding the LocalTimeConverter like so:
var settings = new ConnectionSettings(uri);
settings.SetDefaultIndex(index);
settings.AddContractJsonConverters(t => typeof (LocalTime).IsAssignableFrom(t) ? NodaConverters.LocalTimeConverter : null);
But it results in this JsonReaderException:
Could not convert string to integer: 12:30:00. Path 'hits.hits[0]._source.timeBlocks[0].startTime', line 1, position 664.
I honestly can't tell if I'm doing something wrong or if there is an issue somewhere. Any assistance would be greatly appreciated.