-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Elastic.Clients.Elasticsearch version: 8.*
Elasticsearch version: 8.*
.NET runtime version: 9
Operating system version: Windows 11
Description of the problem including expected versus actual behavior:
The Nest driver used to support mapping nested objects fluently using generics
e.g. descriptor.Nested<SomeType>(n => n.Name(s => s.ListOfSomeType).Properties(s => s.Keyword(k => k.SomePropertyOfSomeType)))
Have I just overlooked how this should be done in the new driver, I have seen other tickets where people mention working around it by using the existing Nested
method but using .First().SomePropertyOfSomeType
all over the place ?
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
flobernd commentedon Feb 11, 2025
Hi @tommymonk ,
nested mappings do still support generics, but they always operate on the top-level type:
Please let me know if that answers your question.
tommymonk commentedon Feb 11, 2025
I see, it feels like a step backwards to me from what we had in Nest.
For complex mappings with the same type appearing in multiple parts of the mapping I have separate method that handle that type, it worked nicely.
I've had to spend hours going through changing everything to
nameof(Class.Property)
because it's just too repetitive and clumsy this new wayflobernd commentedon Feb 11, 2025
It might be worth adding overloads for the nested mappings.
We sadly lost a bit of convenience here and there with the new auto-generated client. Auto mapping is something still on my todo list as well. I'll review this nested mapping case when I finally have time to work on this part.
Keeping this open as a feature request.
[-]Nested mappings no longer support generics nicely?[/-][+]Feature: Push down generic types when mapping nested properties[/+]