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

[Feature] Elastic 8 - MatchAll won't accept passing nothing #8191

Open
DR9885 opened this issue May 21, 2024 · 1 comment
Open

[Feature] Elastic 8 - MatchAll won't accept passing nothing #8191

DR9885 opened this issue May 21, 2024 · 1 comment

Comments

@DR9885
Copy link

DR9885 commented May 21, 2024

Is your feature request related to a problem? Please describe.
MatchAll requires a configuration to be passed, but most cases developers will pass nothing.

Setting boost is not needed, and neither is naming the query. Which it requires one of these to be set.
f.MatchAll(m => m.QueryName(""))
f.MatchAll(m => m.Boost(0))

Describe the solution you'd like

        var result = await _client.SearchAsync<int>(x => x.Index("")
            .Query(q =>
                q.Bool(b =>
                    b.Filter(f =>
                        f.MatchAll()
                    )
                )
            ), ct); 

Describe alternatives you've considered
None.

Additional context
None

@flobernd
Copy link
Member

Hi @DR9885, thanks for the feature request.

This was as well mentioned in #8150 as far as I remember. I'll keep your dedicated issue open anyways to allow for upvotes.

The same applies to MatchNone and probably some other objects with only optional properties. I'll for now solve it only for these 2 candidates and later one encode that pattern in the code generator so that all of these classes with just optional properties will get an overload that does not require to pass a lambda.

Btw.: A slightly better workaround might be this one:

f.MatchAll(m => {})

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

No branches or pull requests

2 participants