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

Adding WithFieldName interface for QueryBuilders with fieldName #15705

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

dzane17
Copy link
Contributor

@dzane17 dzane17 commented Sep 4, 2024

Description

Adding WithFieldName interface and update QueryBuilder classes that conform - have a fieldName() implementation.

In the Query-Insights plugin, we would like to append fieldName and fieldType data during query shape construction. Some *QueryBuilder classes already provide a fieldName() method, but not all query types necessarily operate on a single field. Adding the WithFieldName interface provides a uniform way to type-check any *QueryBuilder instance and get a singular fieldName when possible. Also once fieldName is known, we can lookup fieldType via index mappings.

Related Issues

Related RFC opensearch-project/query-insights#69

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 Sep 4, 2024

❌ Gradle check result for 089eede: 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?

@dzane17 dzane17 force-pushed the qb-field-name branch 2 times, most recently from 71d1cb1 to 9b6f465 Compare September 4, 2024 23:28
@dzane17 dzane17 changed the title Update QueryBuilders that implement MultiTermQueryBuilder interface Add WithFieldName interface Sep 4, 2024
@dzane17 dzane17 marked this pull request as ready for review September 4, 2024 23:36
Copy link
Collaborator

@jainankitk jainankitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msfroh - Can you also provide your feedback on this PR?

@jainankitk
Copy link
Collaborator

@dzane17 - Can you add CHANGELOG.md for this change?

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.17 failed:

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

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.17 2.17
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.17
# Create a new branch
git switch --create backport/backport-15705-to-2.17
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f5c897cf1db3d413c6ccd9bcad1284a7873a1556
# Push it to GitHub
git push --set-upstream origin backport/backport-15705-to-2.17
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.17

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

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.97%. Comparing base (6f2ea39) to head (e59c4d9).
Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #15705      +/-   ##
============================================
+ Coverage     71.95%   71.97%   +0.01%     
- Complexity    64196    64204       +8     
============================================
  Files          5271     5271              
  Lines        300171   300171              
  Branches      43380    43380              
============================================
+ Hits         215990   216037      +47     
+ Misses        66476    66401      -75     
- Partials      17705    17733      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 5, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 5, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 5, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 5, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
jainankitk added a commit that referenced this pull request Sep 5, 2024
… fieldName (#15765)

* Adding WithFieldName interface for QueryBuilders with fieldName (#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)

* Update CHANGELOG.md

Signed-off-by: Ankit Jain <akjain@amazon.com>

---------

Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 5, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 6, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 9, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
dzane17 added a commit to dzane17/OpenSearch that referenced this pull request Sep 9, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
jainankitk pushed a commit that referenced this pull request Sep 9, 2024
…) (#15763)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
(cherry picked from commit f5c897c)
akolarkunnu pushed a commit to akolarkunnu/OpenSearch that referenced this pull request Sep 10, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 16, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 17, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
dk2k pushed a commit to dk2k/OpenSearch that referenced this pull request Oct 21, 2024
…search-project#15705)

Signed-off-by: David Zane <davizane@amazon.com>
Signed-off-by: Ankit Jain <akjain@amazon.com>
Co-authored-by: Ankit Jain <akjain@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants