KQL: Support boolean operators in field queries#133737
Merged
afoucret merged 9 commits intoelastic:mainfrom Aug 29, 2025
Merged
KQL: Support boolean operators in field queries#133737afoucret merged 9 commits intoelastic:mainfrom
afoucret merged 9 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
Collaborator
|
Hi @afoucret, I've created a changelog YAML for you. |
…kql-fix-132366
d7c272f to
636ad82
Compare
kderusso
reviewed
Aug 28, 2025
Member
kderusso
left a comment
There was a problem hiding this comment.
Nice work, left some minor comments, will leave the grammar review to others 👍
x-pack/plugin/kql/src/main/java/org/elasticsearch/xpack/kql/parser/KqlAstBuilder.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/kql/src/main/java/org/elasticsearch/xpack/kql/parser/KqlAstBuilder.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/kql/src/test/java/org/elasticsearch/xpack/kql/parser/KqlParserTests.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/kql/src/test/java/org/elasticsearch/xpack/kql/parser/KqlParserTests.java
Outdated
Show resolved
Hide resolved
| { | ||
| "query": { "kql": { "query": "text_field:(bar OR baz)" } } | ||
| } | ||
| - match: { hits.total: 2 } |
Contributor
Author
There was a problem hiding this comment.
Not really needed cause the index contains only two docs, so just checking the number of results is enough to check that all docs are returned.
x-pack/plugin/kql/src/yamlRestTest/resources/rest-api-spec/test/kql/10_kql_basic_query.yml
Show resolved
Hide resolved
x-pack/plugin/kql/src/yamlRestTest/resources/rest-api-spec/test/kql/10_kql_basic_query.yml
Outdated
Show resolved
Hide resolved
added 2 commits
August 29, 2025 10:37
…kql-fix-132366
…kql-fix-132366
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
afoucret
added a commit
to afoucret/elasticsearch
that referenced
this pull request
Aug 29, 2025
This was referenced Aug 29, 2025
afoucret
added a commit
to afoucret/elasticsearch
that referenced
this pull request
Aug 29, 2025
(cherry picked from commit 36a00d1)
Contributor
Author
💔 Some backports could not be created
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
afoucret
added a commit
to afoucret/elasticsearch
that referenced
this pull request
Aug 29, 2025
(cherry picked from commit 36a00d1)
elasticsearchmachine
pushed a commit
that referenced
this pull request
Aug 29, 2025
elasticsearchmachine
pushed a commit
that referenced
this pull request
Aug 29, 2025
This was referenced Sep 1, 2025
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #132366
Description
This pull request introduces support for boolean operators (
AND,OR,NOT) within KQL field queries.Previously, it was not possible to combine multiple conditions for a single field using boolean logic. For instance, a query like
response:(200 AND ok)would not be parsed correctly.Changes summary:
Example:
A query like
response:((200 AND "OK") OR 404)is now supported and will be translated into the appropriate boolean query.