Skip to content

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

Closed
@niemyjski

Description

@niemyjski

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions