Migrating Fluent Mappings from NEST to Elastic.Clients.Elasticsearch 8.1.1 Client

How are we supposed to migrate a code like the following using NEST 7.17.5 to the new Elastic.Clients.Elasticsearch 8.1.1 client where the method .Object does not accept any longer the generic type of the child object.

public static TypeMappingDescriptor<CarPark> MapCarParkEntity(TypeMappingDescriptor<CarParkEntity> mapper)
{
	return mapper.Properties(ps => ps
		.Keyword(p => p.Id)		
		.Text(p => p.Name)
		
		.Object<CarParkFloor>(o => o.Floors, s => s
			.Properties(op => op
				.Keyword(opn => opn.FloorId))				
				.Object<CarParkFloorBay>(io => io
					.Name(ion => ion.Name)
					.Properties(iop => iop
						.Keyword(ios => ios.Name(ion => ion.Name))
						.IntegerNumber(ios => ios.Name(ion => ion.Count).Index(false))))
								   
}

public class CarParkEntity
{
	[JsonProperty("Id")]
    public string Id { get; set; }
	
	[JsonProperty("name")]
    public string Name { get; set; }
	
	[JsonProperty("floors")]
    public List<CarParkFloor> Floors { get; set; }
}

public class CarParkFloor
{
   [JsonProperty("floorId")]
   public string FloorId { get; set; }
   
   [JsonProperty("bays")]   
   public List<CarParkFloorBay> Bays { get; set; }
}

public class CarParkBay
{
	[JsonProperty("name")]
    public string Name { get; set; }
	
	[JsonProperty("count")]
    public int Count { get; set; }	
}

Regards

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