Skip to content

Null check field names in QueryStringQueryBuilder #18194

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

Merged
merged 3 commits into from
May 5, 2025

Conversation

dbwiddis
Copy link
Member

@dbwiddis dbwiddis commented May 4, 2025

Description

Adds a check for a null value before getting text on a field name, which would otherwise throw an IllegalStateException. This results in a (useful) Parsing exception and 400 rest status describing the error, rather than a 500 error.

Related Issues

Fixes #18131 (together with #18161)

Check List

  • Functionality includes testing.
  • [ ] API changes companion pull request created, if applicable.
  • [ ] Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

github-actions bot commented May 4, 2025

❌ Gradle check result for 9519cf9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@dbwiddis dbwiddis force-pushed the query-builder-null branch from 9519cf9 to f7f7326 Compare May 4, 2025 21:55
Copy link
Contributor

github-actions bot commented May 4, 2025

❌ Gradle check result for f7f7326: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@dbwiddis dbwiddis force-pushed the query-builder-null branch from f7f7326 to 4c7f6bb Compare May 4, 2025 22:58
dbwiddis added 2 commits May 5, 2025 08:46
Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
@dbwiddis dbwiddis force-pushed the query-builder-null branch from cb430bf to adde2dd Compare May 5, 2025 15:46
Copy link
Contributor

github-actions bot commented May 5, 2025

✅ Gradle check result for adde2dd: SUCCESS

Signed-off-by: Andrew Ross <andrross@amazon.com>
Copy link
Contributor

github-actions bot commented May 5, 2025

❌ Gradle check result for 58d0fda: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented May 5, 2025

❌ Gradle check result for 58d0fda: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented May 5, 2025

✅ Gradle check result for 58d0fda: SUCCESS

@dbwiddis dbwiddis merged commit 379e464 into opensearch-project:main May 5, 2025
30 checks passed
@dbwiddis dbwiddis deleted the query-builder-null branch May 5, 2025 21:09
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.19 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.19 2.19
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.19
# Create a new branch
git switch --create backport/backport-18194-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 379e4643fe13740f6ef7075de98de53fe05902c8
# Push it to GitHub
git push --set-upstream origin backport/backport-18194-to-2.19
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.19

Then, create a pull request where the base branch is 2.19 and the compare/head branch is backport/backport-18194-to-2.19.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.19 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.19 2.19
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.19
# Create a new branch
git switch --create backport/backport-18194-to-2.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 379e4643fe13740f6ef7075de98de53fe05902c8
# Push it to GitHub
git push --set-upstream origin backport/backport-18194-to-2.19
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.19

Then, create a pull request where the base branch is 2.19 and the compare/head branch is backport/backport-18194-to-2.19.

dbwiddis added a commit to dbwiddis/OpenSearch that referenced this pull request May 7, 2025
…#18194)

* Null check field names in QueryStringQuerybuilder

Signed-off-by: Daniel Widdis <widdis@gmail.com>

* Restrict test to run on >=3.1.0

Signed-off-by: Daniel Widdis <widdis@gmail.com>

---------

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Andrew Ross <andrross@amazon.com>
Co-authored-by: Andrew Ross <andrross@amazon.com>
(cherry picked from commit 379e464)
andrross added a commit that referenced this pull request May 8, 2025
* Null check field names in QueryStringQuerybuilder



* Restrict test to run on >=3.1.0



---------




(cherry picked from commit 379e464)

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Andrew Ross <andrross@amazon.com>
Co-authored-by: Andrew Ross <andrross@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.19 backport-failed bug Something isn't working Search Search query, autocomplete ...etc v3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Some XContent "parsing" exceptions in SearchSourceBuilder#parseXContent return 500 status
3 participants