Skip to content
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

No way to filter on sub-objects for QueryDescriptor<T> #50

Closed
ghost opened this issue Jun 21, 2012 · 2 comments
Closed

No way to filter on sub-objects for QueryDescriptor<T> #50

ghost opened this issue Jun 21, 2012 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 21, 2012

If I have an object graph of something like:

Deal ->
    Proposals ->
          Id
          Name
          Years ->
               Quarters

And I want to filter on all proposals with an Id of 2 & 5, I don't see a way to do that. Would it work to do something like:
body => body.Filter(f => f.Terms(t => t.Proposals[0].Id, [2,5]))?

@Mpdreamz
Copy link
Member

Yes that will work

The expresion is purely for path resolving t.Proposals.First() would also be safe to call.

Both array access or a call to First() or even FirstOrDefault() will resolve to proposals.id and not proposals[0].id since that is not really valid in Elasticsearch.

@ghost
Copy link
Author

ghost commented Jun 21, 2012

Was going to reply with the same comment, switching to First() worked perfectly. Thanks for the quick response again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant