-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Queries/nested query #70
Conversation
@msanguineti Thanks for getting the ball rolling on this 👍! This approach works, however it leaves the bulk of the query building to the user. What do you think about an approach similar to how new Bodybuilder()
.query('nested', 'name', 'term', 'user', 'kimchy')
.build() |
Related to #36. |
@danpaz indeed this is a very quick PR, but with what you propose how would the API give me this:
What I do is to create a match query and a range filter, then I create a bool query (must) to which I pass the [match, range] object. Finally, I pass this big object into the nested query. Of course the nested query is within something else as well... So what is needed is a generic mechanism to nest/embed/compose queries and filters. At the very first level yes, something like nested filters is necessary so that the user passes parameters and the API builds the query/filter, but then you might need to start composing things. To rephrase it a bit, I consider the nested query not as a final or leaf query, but more of a compound query much like bool query which wraps other queries. Maybe I am missing something here :) so please correct me if I am talking out of my backside. |
I think that's exactly right. There's discussion around this idea in #65, creating a generic API for queries/filters/aggregations which can be more easily composed. I can push the local branch that I've been experimenting with later today and I would love your feedback! |
I've checked out your experimental branch. I will report back but first impression is good, this is the right track. |
The next version of bodybuilder will support
And see this example for its usage. If this doesn't solve your issue please reopen! |
Hello,
I've made this quick PR for nested queries, i.e. queries over nested objects. Also updated the docs section.
Anything missing?