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

**URL:** https://discuss.elastic.co/t/migrating-fluent-mappings-from-nest-to-elastic-clients-elasticsearch-8-1-1-client/335077
**Category:** Elasticsearch
**Tags:** language-clients
**Created:** [June 2, 2023, 12:33pm UTC](https://discuss.elastic.co/t/migrating-fluent-mappings-from-nest-to-elastic-clients-elasticsearch-8-1-1-client/335077 "2023-06-02T12:33:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jrogalan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jrogalan/32/121787_2.png) [@jrogalan](https://discuss.elastic.co/u/jrogalan)
#### Post date: [June 2, 2023, 12:33pm UTC](https://discuss.elastic.co/t/migrating-fluent-mappings-from-nest-to-elastic-clients-elasticsearch-8-1-1-client/335077/1 "2023-06-02T12:33:02Z")

</div>

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.

```auto
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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 30, 2023, 12:33pm UTC](https://discuss.elastic.co/t/migrating-fluent-mappings-from-nest-to-elastic-clients-elasticsearch-8-1-1-client/335077/2 "2023-06-30T12:33:54Z")

</div>

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