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

Allow to configure the Elasticsearch connection in environment variables #8585

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

josegar74
Copy link
Member

This pull request allows to configure the Elasticsearch connection using environment variables.

Checklist

  • I have read the contribution guidelines
  • Pull request provided for main branch, backports managed with label
  • Good housekeeping of code, cleaning up comments, tests, and documentation
  • Clean commit history broken into understandable chucks, avoiding big commits with hundreds of files, cautious of reformatting and whitespace changes
  • Clean commit messages, longer verbose messages are encouraged
  • API Changes are identified in commit messages
  • Testing provided for features or enhancements using automatic tests
  • User documentation provided for new features or enhancements in manual
  • Build documentation provided for development instructions in README.md files
  • Library management using pom.xml dependency management. Update build documentation with intended library use and library tutorials or documentation

@josegar74 josegar74 added this to the 4.4.7 milestone Jan 7, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@josegar74 josegar74 requested a review from davidblasby February 5, 2025 06:56
@davidblasby
Copy link
Contributor

davidblasby commented Feb 5, 2025

@josegar74 - I've noticed some inconsistencies in the configuration (nothing to do with this PR).

By this I mean;

  1. If I set es.host (vi the EnvVars), then it doesn't really really get used. It will be replaced with es.url - which will be localhost (defined earlier).
  2. the EsRestClient partially used es.url and partially es.* vars.
    • RestClientBuilder builder = RestClient.builder(new HttpHost(serverHost, Integer.parseInt(serverPort), serverProtocol));
  • this is using the defined es.port, es.host, etc.. NOT THE es.url
  • the next line if (serverUrl.startsWith("https://")) -- this is using es.url INSTEAD of es.protocol

So, you must:

  1. define all the es.* variables
  2. have es.url consistent with the set variables.

I'm not quite sure what will happen if this is run in a WAR - I don't think es.* will be set as per the pom.xml.

I'm not quite sure how to fix this so its consistent and doesn't affect current installations.
I think we need to ignore es.url - its not really being used anywhere and the main config comes from the es.* variables.

@davidblasby
Copy link
Contributor

@josegar74 - I created this PR (to this PR) that fixes those inconsistencies.

However, you can probably just merge this with just a doc change: Note that the individual components AND es.url MUST BE consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants