Swap to using Spring boot elastic auto configuration, fixes health check failing#205
Draft
jacomago wants to merge 1 commit intoChannelFinder:masterfrom
Draft
Swap to using Spring boot elastic auto configuration, fixes health check failing#205jacomago wants to merge 1 commit intoChannelFinder:masterfrom
jacomago wants to merge 1 commit intoChannelFinder:masterfrom
Conversation
…-configuration ElasticConfig now exposes a single @bean RestClient built from the existing elasticsearch.* properties. Spring Boot's ElasticsearchClientAutoConfiguration detects this bean and auto-configures ElasticsearchTransport and ElasticsearchClient on top of it. This also activates ElasticsearchRestClientHealthContributorAutoConfiguration, fixing the /actuator/health elasticsearch indicator that was previously broken. No changes to application.properties are required — all existing elasticsearch.* connection properties continue to work unchanged: elasticsearch.host_urls (preferred) elasticsearch.network.host (deprecated, still supported) elasticsearch.http.port (deprecated, still supported) elasticsearch.authorization.header elasticsearch.authorization.username elasticsearch.authorization.password Internal changes: - Removed the duplicate searchClient/indexClient @bean methods and the manual createClient() factory; there is now exactly one ElasticsearchClient bean in the context - Removed @qualifier("indexClient") from ChannelRepository, PropertyRepository, TagRepository, ChannelScrollController, and PopulateDBConfiguration - InfoController now injects ElasticsearchClient directly instead of going through ElasticConfig.getSearchClient() - ElasticConfig no longer implements ServletContextListener; Spring Boot manages the RestClient lifecycle Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



This uses a more standard (although not completely standard) way of configuring the elastic search client.
Does this by creating a RestClient bean rather than the per index elastic beans.
Note that I could have gone even more standard by autowiring the RestClient from the Spring Boot auto configuration, but that would have mean the application.properties properties for configuring the connection would have to have a new prefix from elasticsearch to spring.elasticsearch.