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

8.15.6 - QueryDescriptor Operand/Operator (!, ||, &&) overloads #8348

Closed
niemyjski opened this issue Sep 16, 2024 · 1 comment
Closed

8.15.6 - QueryDescriptor Operand/Operator (!, ||, &&) overloads #8348

niemyjski opened this issue Sep 16, 2024 · 1 comment

Comments

@niemyjski
Copy link
Contributor

Elastic.Clients.Elasticsearch version: 8.15.6

Elasticsearch version: 8.15.1

.NET runtime version: 8.x

Operating system version: Any

Description of the problem including expected versus actual behavior:

We've been able to do these kind of queries since the beginning of time.

await Client.SearchAsync<MyType>(d => d
            .Index(index).Query(f => f.Term(m => m.Field(tf => tf.Field1).Value("value1")) && !f.Term(m => m.Field(tf => tf.Field2).Value("value2"))));

//   ElasticQueryParserTests.cs(674, 95): [CS0023] Operator '!' cannot be applied to operand of type 'QueryDescriptor<MyType>'

wait Client.SearchAsync<MyType>(d => d.Index(index)
                .Query(q => q.Bool(b => b.Filter(f => f
                    .Term(m => m.Field(tf => tf.Field1).Value("value1")) &&
                        (f.Term(m => m.Field(tf => tf.Field2).Value("value2")) || f.Term(m => m.Field(tf => tf.Field3).Value("value3")))))));

// ElasticQueryParserTests.cs(748, 26): [CS0019] Operator '||' cannot be applied to operands of type 'QueryDescriptor<MyType>' and 'QueryDescriptor<MyType>'

Expected behavior

We should be able to generate Must / Should queries using the query descriptor (without this it is a massive breaking change).

Reference: FoundatioFx/Foundatio.Parsers#84

@flobernd
Copy link
Member

Duplicate of #8002

@flobernd flobernd marked this as a duplicate of #8002 Sep 23, 2024
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