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

Make configuring client nodes stricter with less inference #1690

Closed
sethmlarson opened this issue Aug 25, 2021 · 1 comment
Closed

Make configuring client nodes stricter with less inference #1690

sethmlarson opened this issue Aug 25, 2021 · 1 comment

Comments

@sethmlarson
Copy link
Contributor

Currently all of the following methods for configuring clients work in 7.x:

Elasticsearch() # [{}]
Elasticsearch([{}]) # [{}]
Elasticsearch("localhost") # [{'host': 'localhost'}]
Elasticsearch("localhost:9443") # [{'host': 'localhost', 'port': 9443}]
Elasticsearch("http://localhost") # [{'host': 'localhost'}]
Elasticsearch("http://localhost:9443") # [{'host': 'localhost', 'port': 9443}]
Elasticsearch("http://user:pass@localhost") # [{'host': 'localhost', 'http_auth': 'user:pass'}]
Elasticsearch("http://user:pass@localhost:9443") # [{'host': 'localhost', 'port': 9443, 'http_auth': 'user:pass'}]
Elasticsearch("http://localhost/a") # [{'host': 'localhost', 'url_prefix': '/a'}]
Elasticsearch("http://localhost:9443/a") # [{'host': 'localhost', 'port': 9443, 'url_prefix': '/a'}]
Elasticsearch("https://localhost") # [{'host': 'localhost', 'port': 443, 'use_ssl': True}]
Elasticsearch("https://localhost:9443") # [{'host': 'localhost', 'port': 9443, 'use_ssl': True}]

Any configuration that doesn't mention host, port, or use_ssl uses the default values of localhost, 9200, and False which can be super confusing in some situations! Proposed change is to make it impossible to configure a client with inference unless using the default client Elasticsearch().

So the following configurations would be disallowed:

Elasticsearch("localhost") # [{'host': 'localhost'}]
Elasticsearch("localhost:9443") # [{'host': 'localhost', 'port': 9443}]
Elasticsearch("http://localhost") # [{'host': 'localhost'}]
Elasticsearch("http://localhost:9443") # [{'host': 'localhost', 'port': 9443}]
Elasticsearch("http://user:pass@localhost") # [{'host': 'localhost', 'http_auth': 'user:pass'}]
Elasticsearch("http://localhost/a") # [{'host': 'localhost', 'url_prefix': '/a'}]
Elasticsearch("https://localhost") # [{'host': 'localhost', 'port': 443, 'use_ssl': True}]

and the following will be allowed:

Elasticsearch() # [{}]
Elasticsearch([{}]) # [{}]
Elasticsearch("http://localhost:9443") # [{'host': 'localhost', 'port': 9443}]
Elasticsearch("http://user:pass@localhost:9443") # [{'host': 'localhost', 'port': 9443, 'http_auth': 'user:pass'}]
Elasticsearch("http://localhost:9443/a") # [{'host': 'localhost', 'port': 9443, 'url_prefix': '/a'}]
Elasticsearch("https://localhost:9443") # [{'host': 'localhost', 'port': 9443, 'use_ssl': True}]
@sethmlarson
Copy link
Contributor Author

This is resolved in #1753

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

No branches or pull requests

1 participant