-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[BUG] Exception when using tf Painless method suggests using the deprecated classic similarity #9958
Comments
This error message is generated by the TF constructor in lucene, not OpenSearch. https://github.com/apache/lucene/blob/a7202e2e6fdf119e7f1971a47b77648fd767f4c1/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/TFValueSource.java#L57-L60 The classic similarity constructor in Lucene can be found here and OpenSearch uses it in various:
Discussion in lucene: apache/lucene#8430
However, with OpenSearch, the construction of classic similarity using the index mapping API is disabled. I think we should remove tf value source support in OpenSearch. And I'd like to discuss with the community on the long-term direction of removing Classic Similarity. For example, in 2.x, we could remove createClassicSimilarity and Classic Similarity from builtIn of Similarity Service since it's no longer used in OpenSearch codebase. In 3.0 and future versions, we could research on whether fully remove classic similarity usage in other places (Term Vectors, MLT query, etc.). |
Should we have added support for the |
Good point, unless OpenSearch support ClassicSimilarity users could not really use tf() function in practice. The bugfix should remove the support of |
Describe the bug
Without the correct setup, if a user calls the
tf
Painless method in thescript_score
query, the user gets back an UnsupportedOperationException:This exception instructs the user to use
classic
similarity. If the user then executes a query to set the similarity to classic:the user gets an exception saying that the
classic
similarity is deprecated and to use theBM25
similarity in its place.To Reproduce
Steps to reproduce the behavior:
Expected behavior
Instead of
classic
, the exception should instruct the user to use theBM25
similarity:unsupported_operation_exception: requires a TFIDFSimilarity (such as BM25Similarity)
Host/Environment (please complete the following information):
Additional context
See discussion in the documentation PR opensearch-project/documentation-website#4988
The text was updated successfully, but these errors were encountered: