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

[Feature] Expose term frequency in Painless script score context #9081

Conversation

noCharger
Copy link
Contributor

@noCharger noCharger commented Aug 2, 2023

Description

Expose term frequency in Painless script score context.

Related Issues

Original issue - #7558
RFC - #8702

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

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.

@noCharger noCharger added Search Search query, autocomplete ...etc skip-changelog labels Aug 2, 2023
@noCharger
Copy link
Contributor Author

cc: @russcam @reta @msfroh @nknize @jainankitk @rishabhmaurya

@github-actions
Copy link
Contributor

github-actions bot commented Aug 2, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:


> Task :checkCompatibility
Checking compatibility for: https://github.com/opensearch-project/reporting.git with ref: main
Incompatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/ml-commons.git]
Compatible components: [https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git]

BUILD SUCCESSFUL in 29m 53s

@noCharger noCharger force-pushed the feature-painless-field-stats-louis-dev branch from 7aff647 to 421dabc Compare August 3, 2023 15:50
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/security-analytics.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 25m 55s

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.

@noCharger - Changes look good! Since @russcam validated the changes, we can get the PR out of draft mode and add some unit tests

@noCharger noCharger force-pushed the feature-painless-field-stats-louis-dev branch from 7278800 to c7114c9 Compare August 4, 2023 16:58
@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Gradle Check (Jenkins) Run Completed with:

@noCharger noCharger force-pushed the feature-painless-field-stats-louis-dev branch from c7114c9 to 854ca55 Compare August 4, 2023 17:16
@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/reporting.git]

BUILD SUCCESSFUL in 26m 42s

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Gradle Check (Jenkins) Run Completed with:

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:


> Task :checkCompatibility
Checking compatibility for: https://github.com/opensearch-project/reporting.git with ref: main
Incompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/reporting.git]

BUILD SUCCESSFUL in 31m 16s

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/performance-analyzer-rca.git]

BUILD SUCCESSFUL in 37m 33s

@noCharger noCharger force-pushed the feature-painless-field-stats-louis-dev branch from 854ca55 to 1c7f13e Compare August 4, 2023 17:57
@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/reporting.git]

BUILD SUCCESSFUL in 33m 25s

@github-actions
Copy link
Contributor

github-actions bot commented Aug 4, 2023

Gradle Check (Jenkins) Run Completed with:

@noCharger
Copy link
Contributor Author

Gradle Check (Jenkins) Run Completed with:

Unable to reproduce on local dev env

./gradlew :server:internalClusterTest 
BUILD SUCCESSFUL in 27m 25s         

@reta
Copy link
Collaborator

reta commented Aug 11, 2023

@noCharger looks pretty cool, thank you!

@opensearch-trigger-bot
Copy link
Contributor

Compatibility status:



> Task :checkCompatibility
Incompatible components: [https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/reporting.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/performance-analyzer.git]
Compatible components: [https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git]

BUILD SUCCESSFUL in 29m 19s

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@noCharger noCharger marked this pull request as ready for review August 11, 2023 18:58
@noCharger noCharger requested a review from anasalkouz as a code owner August 11, 2023 18:58
@msfroh msfroh merged commit 5d3633c into opensearch-project:main Aug 23, 2023
@msfroh msfroh added the backport 2.x Backport to 2.x branch label Aug 23, 2023
@opensearch-trigger-bot
Copy link
Contributor

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

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-9081-to-2.x.

@msfroh
Copy link
Collaborator

msfroh commented Aug 23, 2023

@noCharger, looks like the 2.x backport failed. Can you please create a manual backport PR?

neetikasinghal pushed a commit to neetikasinghal/OpenSearch that referenced this pull request Aug 23, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
@noCharger
Copy link
Contributor Author

noCharger commented Aug 23, 2023

@noCharger, looks like the 2.x backport failed. Can you please create a manual backport PR?

https://github.com/opensearch-project/OpenSearch/actions/runs/5946439300/job/16126992801#step:3:33

CONFLICT (content): Merge conflict in CHANGELOG.md

@msfroh Created an manual backport PR #9517

noCharger added a commit to noCharger/OpenSearch that referenced this pull request Aug 23, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
(cherry picked from commit 5d3633c)
noCharger added a commit to noCharger/OpenSearch that referenced this pull request Aug 23, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
(cherry picked from commit 5d3633c)
noCharger added a commit to noCharger/OpenSearch that referenced this pull request Aug 23, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
(cherry picked from commit 5d3633c)
msfroh pushed a commit that referenced this pull request Aug 23, 2023
…) (#9517)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
(cherry picked from commit 5d3633c)
@navneet1v
Copy link
Contributor

navneet1v commented Aug 23, 2023

@noCharger
Is this change moved available in Snapshot of OpenSearch. I am getting this error

java.lang.AbstractMethodError: Receiver class org.opensearch.knn.plugin.script.KNNScoringScriptEngine$$Lambda$3766/0x0000000800d30040 does not define or inherit an implementation of the resolved method 'abstract org.opensearch.script.ScoreScript$LeafFactory newFactory(java.util.Map, org.opensearch.search.lookup.SearchLookup)' of interface org.opensearch.script.ScoreScript$Factory.

which feels like the snapshot I have of OpenSearch is pointing to older version where the new interface of ScoreScript.Factory is not present.

This blocking the development of features in the K-NN plugin.

Validated this by building a local distribution of Opensearch core to run the integration tests.

@noCharger
Copy link
Contributor Author

@noCharger Is this change moved available in Snapshot of OpenSearch. I am getting this error

java.lang.AbstractMethodError: Receiver class org.opensearch.knn.plugin.script.KNNScoringScriptEngine$$Lambda$3766/0x0000000800d30040 does not define or inherit an implementation of the resolved method 'abstract org.opensearch.script.ScoreScript$LeafFactory newFactory(java.util.Map, org.opensearch.search.lookup.SearchLookup)' of interface org.opensearch.script.ScoreScript$Factory.

which feels like the snapshot I have of OpenSearch is pointing to older version where the new interface of ScoreScript.Factory is not present.

This blocking the development of features in the K-NN plugin.

Validated this by building a local distribution of Opensearch core to run the integration tests.

@navneet1v Which snapshot does the knn plugin employ? I'd get the snapshot from here: https://artifacts.opensearch.org/snapshots/core/opensearch/version>.-SNAPSHOT/opensearch-min--SNAPSHOT-linux-x64-latest.tar.gz

For example, the linux one was created at 4:25 PM PST on 08-23-2023.

austintlee pushed a commit to austintlee/OpenSearch that referenced this pull request Aug 25, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Gaganjuneja pushed a commit to Gaganjuneja/OpenSearch that referenced this pull request Aug 28, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Gaganjuneja pushed a commit to Gaganjuneja/OpenSearch that referenced this pull request Aug 28, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Gagan Juneja <[email protected]>
kkmr pushed a commit to kkmr/OpenSearch that referenced this pull request Aug 28, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Kiran Reddy <[email protected]>
kaushalmahi12 pushed a commit to kaushalmahi12/OpenSearch that referenced this pull request Sep 12, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Kaushal Kumar <[email protected]>
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Ivan Brusic <[email protected]>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…nsearch-project#9081)

Add the following functions in Painless script score context:
* termfreq
* tf
* totaltermfreq
* sumtotaltermfreq

Each of these maps to a Lucene value source.

Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Shivansh Arora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport-failed Search Search query, autocomplete ...etc v2.10.0
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants