-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Spring Data Elasticsearch: ClassCastException thrown in existsBy* repository method #2162
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
Labels
type: bug
A general bug
Comments
This is a bug, currently the fact that it is a exists method is not taken into account, and as the return type is no As a workaround change your method to do a count instead: Long countOrderLineDocumentByReviewRequestDocumentIdAndProductId(String reviewRequestDocumentId, String productId); and check if the result is greater than zero. |
Cool, looking forward for this to be fixed! |
sothawo
added a commit
to sothawo/spring-data-elasticsearch
that referenced
this issue
Jul 22, 2022
sothawo
added a commit
that referenced
this issue
Jul 22, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've got this trivial index in ES:
To work with it I use Spring Data Elasticsearch, so an entity and bound repository are created:
The problem I'm facing is related to repository method
existsByReviewRequestDocumentIdAndProductId()
which is called from test method:Calling it results in ClassCastException with this stack trace:
It looks like the method queries the whole entity from ES instead of fetching simple
boolean
.Does anyone aware of such issues? Is it a bug or have I misconfigured something?
P.S. I've tried also
and
same exception is thrown.
The text was updated successfully, but these errors were encountered: