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
Add possibility to disable the Elasticsearch Sniffer functionality #26949
Add possibility to disable the Elasticsearch Sniffer functionality #26949
Conversation
0d91b24
to
bf04333
Compare
Looking at the auto-configuration it doesn’t seem like there’s currently an easy way to exclude the sniffer whilst keeping everything else. I think another way to disable it would be good. That could be a property, or we could extract a new auto-configuration class. |
Using a different AutoConfiguration class would work as well. We already have a mechanism that uses I created this PR since it was easy to do it and I thought I should just do it and we can discuss in the PR, without the need to go through issues. |
We discussed this today as team and we'd currently prefer to leave things as they are. It feels like having and Elasticsearch Sniffer dependency and not enabling it shouldn't be that common. We've also been trying to reduce the number of If more people comment on this issue, or we find a good reason why the sniffer dependency needs to be present but not used, we can reconsider. |
Regardless, thanks a lot for the PR @filiphr! |
We are having the same issue after updating Spring. We use sniffer in our testing and production environments, however, our developers have a shared environment they connect their u-service to to be able to access a large amount of testing data. This environment is behind an ingress proxy, so developers used to have the sniffer off. After updating spring boot, we are having the issue described in the original post. It would be great to be able to separate the sniffer mechanism from the policy of enabling it or not. The configuration proposed here would be the best approach. Preventing the sniffer from showing up in the classpath in local environments and not in others is not a feasible option. |
@carofe82 there is a way to achieve what you are looking for without the need for a change in Spring Boot. It is a nasty and in my opinion a hacky approach but it it works. Have a look at #28496 (comment) for a hint for how to achieve it. |
@filiphr , |
I am not really sure about the right process to comment on a closed ticket, but here is my contribution/reason towards having an In my project, I have Hibernate Search that brings in Trying to exclude this dependency, the project starts to fail with NoClassDefFoundError
For now, my workaround is to disable Elasticsearch Health Check, but really would like to see it working. Hibernate Search property: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-elasticsearch-configuration-discovery Thank you. |
@felipelo In my opinion, shipping an optional feature as a mandatory compile dependency is not optimal. Maybe that's a change the Hibernate search team could consider? |
@bclozel Thanks for the quick response. I will try with Hibernate team. |
With #24174 out-of-the-box support was added for Elasticsearch Sniffer.
After our upgrade to the latest Spring Boot 2.5.1, we noticed that using Elasticsearch Sniffer with Elasticsearch in Docker was not working correctly (at least not on Mac). The resolved nodes had some IP that could not be accessed from my host. I know that the functionality is there only if the Sniffer is on the classpath (it was for us by mistake).
In my opinion it could be beneficial to enable / disable the functionality using a property as well. This can be interested for application build on top of Spring Boot that would like to offer an opt in to the Sniffer by enabling the flag.