Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 2.24 KB

builder.rst

File metadata and controls

52 lines (44 loc) · 2.24 KB

Client Builder Class

es_client.Builder

Builder Attribute Errata

client

The Elasticsearch Client <elasticsearch.Elasticsearch> object is only created after passing all other tests, and if autoconnect is True

is_master

Initially set to None, this value is set automatically if autoconnect is True. It can otherwise be set by calling ~es_client.Builder._find_master after ~es_client.Builder._get_client has been called first.

Class Instantiation Flow

  1. Check to see if elasticsearch key is in the supplied raw_config dictionary. Log a warning about using defaults if it is not.
  2. Run ~es_client.Builder._check_config on raw_config
  3. Set instance attributes version_max and version_min with the provided values.
  4. Set instance attribute master_only to the value from raw_config
  5. Initialize instance attribute is_master with a None
  6. Set instance attribute skip_version_test to the value from raw_config
  7. Set instance attribute client_args to the value of raw_config['elasticsearch']['client']
  8. Execute ~es_client.Builder._check_basic_auth to build the basic_auth tuple, if username and password are not None.
  9. Execute ~es_client.Builder._check_api_key to build the api_key tuple, if the id and api_key sub-keys are not None.
  10. Execute ~es_client.Builder._check_cloud_id to ensure the client connects to the defined cloud_id rather than anything in hosts.
  11. Execute ~es_client.Builder._check_ssl to ensure we have at least the certifi signing certificates.
  12. If autoconnect is `True`:

    1. Execute ~es_client.Builder._get_client to finally build the Elasticsearch Client <elasticsearch8.Elasticsearch> client object.
    2. Execute ~es_client.Builder._check_version and ~es_client.Builder._check_master as post-checks. Nothing will happen if these checks are not enabled in raw_config