-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow calling SourceInclude without manually specifiying all properties #1737
Comments
Hey @jeroenheijmans, some kind of convention sounds like it would be interesting but it feels specific to your particular use case; NEST tries to stay close to the Elasticsearch API and expose it in .NET using .NET idioms (well, C#!) without unduly layering on top so I don't think this belongs in NEST. Maybe an approach where properties of the POCO that should be returned in GET requests are decorated with a specific attribute and write an extension method to |
@jeroenheijmans zooming back out to your initial comment:
Elasticsearch returns documents from a single This is very much unlike SQL where selecting the minimum number of columns is good practice. If you do want to go with |
I've asked a question on Stack Overflow, because I wanted to use
SourceInclude
to make Nest (1.x) not retrieve all document fields from Elasticsearch.To reiterate the idea I had, consider the following code:
What realistically would happen next (e.g. in a few weeks), is this:
ProductNumber
;Product
with a properElasticProperty
;Get
query, but to his/her surprise the property remains empty;The problem is that this person (probably me) will have to remember to add that property to the
SourceInclude
call. And programmers are pretty bad at remembering to do things that are not automated...The thing is, my code above is not DRY: I'm specifying twice which properties I want to be mapped. Once in the
Product
, and once in theSourceInclude
call. The first one is the logical place (e.g. if I do aMultiGet
somewhere withProduct
I want to reuse the explicit mappings forSourceInclude
) for me.I'm looking for guidance. Am I actually formulating a proper feature request? Or would that feature be bloat for Nest and should I roll my own "typedPathLookups" method? Or am I missing an obvious better solution?
The text was updated successfully, but these errors were encountered: