I created a simple object representing a collection that has elements such as time, location, name, theme, etc., and indexed it in ElasticSearch via Nest. It has an Id field that I leave blank so the ES can generate them.
Later, I received all the documents that do not have the GEO coordinates, so that I can update them. All of my returned items are still null for the id field, and when I upgrade them to ES, it creates new documents for them.
What am I missing here, which makes my entire identifier null?
thanks
Here is the Meeting class (id prop is redundant, but I tried anyway)
[ElasticType(IdProperty = "Id")]
public class Meeting
{
public string Id { get; set; }
public string Code { get; set; }
public string Day { get; set; }
public string Town { get; set; }
public string Name { get; set; }
public string Location { get; set; }
public string OriginalTime { get; set; }
public string OriginalTimeCleaned { get; set; }
public string Handicap { get; set; }
public string FormattedAddress { get; set; }
public Coordinates Coordinates { get; set; }
public List<MeetingTime> Times = new List<MeetingTime>();
public bool IsProcessed { get; set; }
}
This is how i get meetings
public static List<Meeting> GetAddressesWithMissingCoordinates()
{
var result = Client.Search<Meeting>(s => s
.Index("meetings")
.AllTypes()
.Query(p => p.Filtered(f => f.Filter(x => x.Missing(c => c.Coordinates)))));
return result.Documents.ToList();
}
Here is my update statement, Id is null
public static void UpdateMeetingCoordinates(Meeting meeting, Coordinates coordinates)
{
meeting.Coordinates = coordinates;
var response = Client.Index(meeting, u => u
.Index("meetings")
.Type("meeting")
.Refresh()
);
Console.WriteLine(response);
}
I also tried partial updates, but no luck.