ES Client API reference¶
Builder Class¶
- class es_client.builder.Builder(configdict: Dict | None = None, configfile: str | None = None, autoconnect: bool = False)¶
- Parameters:
configdict – A configuration dictionary
configfile – A YAML configuration file
autoconnect – Connect to client automatically
Build a client connection object out of settings from configfile or configdict.
If neither configfile nor configdict is provided, empty defaults will be used.
If both are provided, configdict will be used, and configfile ignored.
- attributes¶
The DotMap storage for attributes and settings
- client¶
The
Elasticsearch
client connection object
- property client_args: DotMap¶
The storage and workspace for
client
settings
- property config: DotMap¶
Configuration settings extracted from
configfile
orconfigdict
- property other_args: DotMap¶
The storage and workspace for
other_settings
Builder Attribute Errata¶
- client:
The
Elasticsearch
object is only created after passing all other tests, and ifautoconnect
isTrue
, orconnect()
has been called.- is_master:
Initially set to
None
, this value is set automatically ifautoconnect
isTrue
. It can otherwise be set by calling_find_master()
after_get_client()
has been called first.
Class Instantiation Flow¶
Check to see if
elasticsearch
key is in the suppliedraw_config
dictionary. Log a warning about using defaults if it is not.Run
_check_config()
onraw_config
Set instance attributes
version_max
andversion_min
with the provided values.Set instance attribute
master_only
to the value fromraw_config
Initialize instance attribute
is_master
with aNone
Set instance attribute
skip_version_test
to the value fromraw_config
Set instance attribute
client_args
to the value ofraw_config['elasticsearch']['client']
Execute
_check_basic_auth()
to build thebasic_auth
tuple, ifusername
andpassword
are notNone
.Execute
_check_api_key()
to build theapi_key
tuple, if theid
andapi_key
sub-keys are notNone
.Execute
_check_cloud_id()
to ensure the client connects to the definedcloud_id
rather than anything inhosts
.Execute
_check_ssl()
to ensure we have at least the certifi signing certificates.If
autoconnect
is True:Execute
_get_client()
to finally build theElasticsearch
client object.Execute
_check_version()
and_check_master()
as post-checks. Nothing will happen if these checks are not enabled inraw_config