Skip to content

[FEATURE] Add overloads that takes multiple QueryDescriptors to Filter()/Must()/MustNot()/Should() of BoolQueryDescriptor #7508

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

Closed
rlindber opened this issue Mar 30, 2023 · 1 comment · Fixed by #8485
Labels
8.x Relates to a 8.x client version Category: Feature
Milestone

Comments

@rlindber
Copy link

Is your feature request related to a problem? Please describe.
The current code using Nest is generating QueryDescriptor object, that are finally combined in a BoolQueryDescriptor with calls to Filter(), Must(), MustNot() or Should(). Example signature from Nest client:

public BoolQueryDescriptor<T> Must(params QueryContainer[] queries)

Describe the solution you'd like
The corresponding function for BoolQueryDescriptor in Elastic.Clients only takes one QueryDescriptor, instead of an array as in Nest. From Elastic.Clients:

public BoolQueryDescriptor<TDocument> Must(QueryDescriptor<TDocument> descriptor)

Could these four function be replaced with functions that take multiple QueryDescriptor objects, e.g. using "params", like this?

public BoolQueryDescriptor<TDocument> Must(params QueryDescriptor<TDocument>[] descriptors)

Describe alternatives you've considered
It would require a lot of work to rewrite the existing code to used a function that take multiple object, like

public BoolQueryDescriptor<TDocument> Must(params Action<QueryDescriptor<TDocument>>[] configure)

or

public BoolQueryDescriptor<TDocument> Must(ICollection<Query>? must)

@stevejgordon stevejgordon added the 8.x Relates to a 8.x client version label Apr 11, 2023
@stevejgordon
Copy link
Contributor

Thanks for raising this, @rlindber. I agree that this would be a good addition since there's no longer a relationship between Query (the equivalent of QueryContainer) and QueryDescriptor<T> (the equivalent of QueryContainerDescriptor) in the v8 client.

We should update the code-generator to handle this for any methods that already include an overload of params Action<QueryDescriptor<TDocument>>[] configure.

@stevejgordon stevejgordon added this to the Future milestone Apr 11, 2023
@stevejgordon stevejgordon changed the title Add overload that takes multiple QueryDescriptors to Filter()/Must()/MustNot()/Should() of BoolQueryDescriptor [FEATURE] Add overloads that takes multiple QueryDescriptors to Filter()/Must()/MustNot()/Should() of BoolQueryDescriptor Apr 11, 2023
@flobernd flobernd mentioned this issue Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.x Relates to a 8.x client version Category: Feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants