Closed
Description
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}]